mirror of
https://github.com/aljazceru/CTFd.git
synced 2025-12-18 14:34:21 +01:00
Scoreboard optimizations (#1476)
* Add speed improvements for /api/v1/scoreboard/top/<count> * Update CHANGELOG * Fix typo * Switch back to processing solves and awards seperately * Fix typo
This commit is contained in:
@@ -122,7 +122,6 @@ class ScoreboardDetail(Resource):
|
||||
awards = awards.all()
|
||||
|
||||
# Build a mapping of accounts to their solves and awards
|
||||
solves = solves + awards
|
||||
solves_mapper = defaultdict(list)
|
||||
for solve in solves:
|
||||
solves_mapper[solve.account_id].append(
|
||||
@@ -136,6 +135,18 @@ class ScoreboardDetail(Resource):
|
||||
}
|
||||
)
|
||||
|
||||
for award in awards:
|
||||
solves_mapper[award.account_id].append(
|
||||
{
|
||||
"challenge_id": None,
|
||||
"account_id": award.account_id,
|
||||
"team_id": award.team_id,
|
||||
"user_id": award.user_id,
|
||||
"value": award.value,
|
||||
"date": isoformat(award.date),
|
||||
}
|
||||
)
|
||||
|
||||
# Sort all solves by date
|
||||
for team_id in solves_mapper:
|
||||
solves_mapper[team_id] = sorted(
|
||||
|
||||
Reference in New Issue
Block a user