Update contest submission points when modifying contest
This commit is contained in:
parent
7e8906ae7e
commit
0a5251f533
1 changed files with 17 additions and 0 deletions
|
@ -20,6 +20,23 @@ def rescore_contest(self, contest_key):
|
||||||
self, participations.count(), stage=_("Recalculating contest scores")
|
self, participations.count(), stage=_("Recalculating contest scores")
|
||||||
) as p:
|
) as p:
|
||||||
for participation in participations.iterator():
|
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()
|
participation.recompute_results()
|
||||||
rescored += 1
|
rescored += 1
|
||||||
if rescored % 10 == 0:
|
if rescored % 10 == 0:
|
||||||
|
|
Loading…
Add table
Reference in a new issue