Skip to content

Commit

Permalink
reset playban tolerance every week
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed Jun 30, 2024
1 parent dd18514 commit 7a4e9ba
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion modules/playban/src/main/model.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ case class UserRecord(

def banInEffect = bans.lastOption.exists(_.inEffect)
def banMinutes = bans.lastOption.map(_.remainingMinutes)
def bansThisWeek =
val since = nowInstant.minusDays(7)
bans.count(_.date.isAfter(since))

def nbOutcomes = outcomes.size

Expand All @@ -36,7 +39,7 @@ case class UserRecord(
else 0.3f

def minBadOutcomes: Int =
bans.size match
bansThisWeek match
case 0 | 1 => 4
case 2 | 3 => 3
case _ => 2
Expand Down

0 comments on commit 7a4e9ba

Please sign in to comment.