From 29ecda476d5055fcf90f664892f09f0e92420a98 Mon Sep 17 00:00:00 2001 From: zema1 Date: Sat, 23 Dec 2017 14:15:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=AF=94=E8=B5=9B=E7=AE=A1=E7=90=86=E5=91=98?= =?UTF-8?q?=E7=9A=84=E6=8F=90=E4=BA=A4=E4=B8=8D=E8=AE=B0=E5=85=A5=E6=AF=94?= =?UTF-8?q?=E8=B5=9Brank=E5=92=8C=E9=A2=98=E7=9B=AE=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- judge/dispatcher.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/judge/dispatcher.py b/judge/dispatcher.py index 7ef91844..289e50a1 100644 --- a/judge/dispatcher.py +++ b/judge/dispatcher.py @@ -180,6 +180,10 @@ class JudgeDispatcher(DispatcherBase): self.release_judge_server(server.id) if self.contest_id: + if self.contest.status != ContestStatus.CONTEST_UNDERWAY or \ + User.objects.get(id=self.submission.user_id).is_contest_admin(self.contest): + logger.info("Contest debug mode, id: " + str(self.contest_id) + ", submission id: " + self.submission.id) + return self.update_contest_problem_status() self.update_contest_rank() else: @@ -240,9 +244,6 @@ class JudgeDispatcher(DispatcherBase): user_profile.save(update_fields=["submission_number", "accepted_number", "oi_problems_status"]) def update_contest_problem_status(self): - if self.contest_id and self.contest.status != ContestStatus.CONTEST_UNDERWAY: - logger.info("Contest debug mode, id: " + str(self.contest_id) + ", submission id: " + self.submission.id) - return with transaction.atomic(): user = User.objects.select_for_update().get(id=self.submission.user_id) user_profile = user.userprofile @@ -282,8 +283,6 @@ class JudgeDispatcher(DispatcherBase): problem.save(update_fields=["submission_number", "accepted_number", "statistic_info"]) def update_contest_rank(self): - if self.contest_id and self.contest.status != ContestStatus.CONTEST_UNDERWAY: - return if self.contest.rule_type == ContestRuleType.OI or self.contest.real_time_rank: cache.delete(f"{CacheKey.contest_rank_cache}:{self.contest.id}") with transaction.atomic():