From 9c01ec8a226ecf2424514e2f96cdfe70cf7a536e Mon Sep 17 00:00:00 2001 From: cuom1999 Date: Tue, 1 Oct 2024 11:07:55 -0500 Subject: [PATCH] Fix contest summary --- judge/admin/contest.py | 2 +- judge/views/contests.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/judge/admin/contest.py b/judge/admin/contest.py index 5b157dc..be07ab3 100644 --- a/judge/admin/contest.py +++ b/judge/admin/contest.py @@ -559,5 +559,5 @@ class ContestsSummaryAdmin(admin.ModelAdmin): def save_model(self, request, obj, form, change): super(ContestsSummaryAdmin, self).save_model(request, obj, form, change) obj.refresh_from_db() - obj.results = recalculate_contest_summary_result(obj) + obj.results = recalculate_contest_summary_result(request, obj) obj.save() diff --git a/judge/views/contests.py b/judge/views/contests.py index f60032f..830a7fa 100644 --- a/judge/views/contests.py +++ b/judge/views/contests.py @@ -1555,7 +1555,7 @@ class ContestsSummaryView(DiggPaginatorMixin, ListView): return context -def recalculate_contest_summary_result(contest_summary): +def recalculate_contest_summary_result(request, contest_summary): scores_system = contest_summary.scores contests = contest_summary.contests.all() total_points = defaultdict(int) @@ -1564,14 +1564,14 @@ def recalculate_contest_summary_result(contest_summary): for i in range(len(contests)): contest = contests[i] - users, problems = get_contest_ranking_list(None, contest) + users, problems = get_contest_ranking_list(request, contest) for rank, user in users: curr_score = 0 if rank - 1 < len(scores_system): curr_score = scores_system[rank - 1] total_points[user.user] += curr_score result_per_contest[user.user][i] = (curr_score, rank) - user_css_class[user.user] = user.css_class + user_css_class[user.user] = user.user.css_class sorted_total_points = [ ContestsSummaryData(