Skip to content

Commit

Permalink
Fixed submissions status in AWS overview.
Browse files Browse the repository at this point in the history
It seems that the union query is not guaranteed to return results in order.
  • Loading branch information
vytisb committed Jan 11, 2025
1 parent 498e2a3 commit e60983e
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions cms/server/admin/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# Copyright © 2012-2016 Luca Wehrstedt <[email protected]>
# Copyright © 2014 Artem Iglikov <[email protected]>
# Copyright © 2014 Fabian Gundlach <[email protected]>
# Copyright © 2020 Vytis Banaitis <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
Expand Down Expand Up @@ -176,13 +177,8 @@ def submissions_status(contest_id):
.filter(Task.contest_id == contest_id)
queries['total'] = total_query

stats = {}
keys = list(queries.keys())
results = queries[keys[0]].union_all(
*(queries[key] for key in keys[1:])).all()
stats = {key: queries[key].one()[0] for key, query in queries.items()}

for i, k in enumerate(keys):
stats[k] = results[i][0]
stats['compiling'] += 2 * stats['total'] - sum(stats.values())

return stats

0 comments on commit e60983e

Please sign in to comment.