fix(clock): colliding points annotation with CustomUser.points field
This commit is contained in:
@@ -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())
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user