Skip to content

Commit

Permalink
prevent colour boosting
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed May 1, 2018
1 parent df3bd88 commit 4f6d6e4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion modules/user/src/main/UserRepo.scala
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,11 @@ object UserRepo {
}

def incColor(userId: User.ID, value: Int): Unit =
coll.update($id(userId), $inc(F.colorIt -> value), writeConcern = GetLastError.Unacknowledged)
coll.update(
$id(userId) ++ (value < 0).??($doc("colorIt" $gt -3)),
$inc(F.colorIt -> value),
writeConcern = GetLastError.Unacknowledged
)

def lichess = byId(User.lichessId)

Expand Down

0 comments on commit 4f6d6e4

Please sign in to comment.