fix(clock): colliding points annotation with CustomUser.points field

This commit is contained in:
2026-10-16 02:30:06 +02:00
parent 377bc91bcb
commit 54ffe89445
2 changed files with 9 additions and 8 deletions
+4 -3
View File
@@ -22,7 +22,8 @@ def _press_points_expression():
def ranked_players(event: Event):
"""All users annotated with their live total points for this event and
"""All users annotated with their live total `clock_points` (not `points`,
that one is the market balance field on CustomUser) for this event and
DB-computed RANK(). Points only ever come from presses made in `event` -
a player's history in another event never leaks into this leaderboard."""
from accounts.models import CustomUser
@@ -32,6 +33,6 @@ def ranked_players(event: Event):
Value(0.0),
output_field=FloatField(),
)
return CustomUser.objects.annotate(points=points).annotate(
rank=Window(expression=Rank(), order_by=F("points").desc())
return CustomUser.objects.annotate(clock_points=points).annotate(
rank=Window(expression=Rank(), order_by=F("clock_points").desc())
)