opus-magnum results view
This commit is contained in:
@@ -26,7 +26,9 @@ def results(request: HttpRequest) -> dict:
|
||||
ranking = {}
|
||||
|
||||
for puzzle_id, responses in responses_by_puzzleid.items():
|
||||
ranking[puzzle_id] = sorted(responses, key=lambda x: x.rank_points)
|
||||
ranking[puzzle_id] = sorted(
|
||||
responses, key=lambda x: (x.rank_points is None, x.rank_points or 0)
|
||||
)
|
||||
|
||||
return {
|
||||
"users": CustomUser.objects.filter(pk__in=responses_by_userid.keys()),
|
||||
|
||||
@@ -30,8 +30,13 @@ class PuzzleResponseRankingOut(ModelSchema):
|
||||
return obj.submission.user.id
|
||||
|
||||
|
||||
class UserDisplayOut(Schema):
|
||||
id: int
|
||||
username: str
|
||||
|
||||
|
||||
class RankingSchema(Schema):
|
||||
users: list[UserInfoOut]
|
||||
users: list[UserDisplayOut]
|
||||
puzzles: list[SteamCollectionItemOut]
|
||||
responses_by_userid: dict[int, list[PuzzleResponseRankingOut]]
|
||||
ranking_by_puzzle: dict[int, list[PuzzleResponseRankingOut]]
|
||||
|
||||
Reference in New Issue
Block a user