比赛管理员的提交不记入比赛rank和题目统计

This commit is contained in:
zema1 2017-12-23 14:15:13 +08:00
parent 218424c9ee
commit 29ecda476d

View File

@ -180,6 +180,10 @@ class JudgeDispatcher(DispatcherBase):
self.release_judge_server(server.id) self.release_judge_server(server.id)
if self.contest_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_problem_status()
self.update_contest_rank() self.update_contest_rank()
else: else:
@ -240,9 +244,6 @@ class JudgeDispatcher(DispatcherBase):
user_profile.save(update_fields=["submission_number", "accepted_number", "oi_problems_status"]) user_profile.save(update_fields=["submission_number", "accepted_number", "oi_problems_status"])
def update_contest_problem_status(self): 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(): with transaction.atomic():
user = User.objects.select_for_update().get(id=self.submission.user_id) user = User.objects.select_for_update().get(id=self.submission.user_id)
user_profile = user.userprofile user_profile = user.userprofile
@ -282,8 +283,6 @@ class JudgeDispatcher(DispatcherBase):
problem.save(update_fields=["submission_number", "accepted_number", "statistic_info"]) problem.save(update_fields=["submission_number", "accepted_number", "statistic_info"])
def update_contest_rank(self): 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: if self.contest.rule_type == ContestRuleType.OI or self.contest.real_time_rank:
cache.delete(f"{CacheKey.contest_rank_cache}:{self.contest.id}") cache.delete(f"{CacheKey.contest_rank_cache}:{self.contest.id}")
with transaction.atomic(): with transaction.atomic():