From 0a5251f53311cd2fad746821e163af708c5d4b76 Mon Sep 17 00:00:00 2001 From: cuom1999 Date: Tue, 14 Feb 2023 17:25:20 -0600 Subject: [PATCH] Update contest submission points when modifying contest --- judge/tasks/contest.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/judge/tasks/contest.py b/judge/tasks/contest.py index ca896a9..beaf2d5 100644 --- a/judge/tasks/contest.py +++ b/judge/tasks/contest.py @@ -20,6 +20,23 @@ def rescore_contest(self, contest_key): self, participations.count(), stage=_("Recalculating contest scores") ) as p: for participation in participations.iterator(): + for contest_submission in participation.submissions.iterator(): + submission = contest_submission.submission + contest_problem = contest_submission.problem + contest_submission.points = round( + submission.case_points + / submission.case_total + * contest_problem.points + if submission.case_total > 0 + else 0, + 3, + ) + if ( + not contest_problem.partial + and contest_submission.points != contest_problem.points + ): + contest_submission.points = 0 + contest_submission.save() participation.recompute_results() rescored += 1 if rescored % 10 == 0: