Skip to content

Commit

Permalink
leaderboard: round only the final score
Browse files Browse the repository at this point in the history
  • Loading branch information
Aiq0 authored Jan 5, 2025
1 parent bdd9b66 commit 44ade2c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions web/proboj/games/leaderboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ def get_leaderboard(game: Game):
scores = defaultdict(lambda: 0)
for match in matches:
for k in scores.keys():
scores[k] = round(scores[k] * 0.999)
scores[k] *= 0.999

for mbot in match.matchbot_set.all():
mbot: MatchBot
if mbot.score is not None:
scores[mbot.bot_version.bot] += mbot.score

leaderboard = list(scores.items())
leaderboard = [(x[0], round(x[1])) for x in scores.items()]
leaderboard.sort(key=lambda x: -x[1])
cache.set(key, leaderboard, 60 * 5)
return leaderboard

0 comments on commit 44ade2c

Please sign in to comment.