mirror of
https://github.com/QingdaoU/OnlineJudge.git
synced 2024-12-29 16:41:56 +00:00
fix rejudge bug
This commit is contained in:
parent
0e83a920b2
commit
86f995d23c
@ -150,7 +150,11 @@ class JudgeDispatcher(DispatcherBase):
|
||||
"spj_compile_config": spj_config.get("compile"),
|
||||
"spj_src": self.problem.spj_code
|
||||
}
|
||||
|
||||
self.last_result = None
|
||||
try:
|
||||
self.last_result = Submission.objects.get(id=self.submission.id).result
|
||||
except Submission.DoesNotExist:
|
||||
pass
|
||||
Submission.objects.filter(id=self.submission.id).update(result=JudgeStatus.JUDGING)
|
||||
|
||||
resp = self._request(urljoin(server.service_url, "/judge"), data=data)
|
||||
@ -193,9 +197,14 @@ class JudgeDispatcher(DispatcherBase):
|
||||
with transaction.atomic():
|
||||
# update problem status
|
||||
problem = Problem.objects.select_for_update().get(contest_id=self.contest_id, id=self.problem.id)
|
||||
problem.submission_number += 1
|
||||
if not self.last_result:
|
||||
problem.submission_number += 1
|
||||
if self.submission.result == JudgeStatus.ACCEPTED:
|
||||
problem.accepted_number += 1
|
||||
if self.last_result != JudgeStatus.ACCEPTED:
|
||||
problem.accepted_number += 1
|
||||
else:
|
||||
if self.last_result == JudgeStatus.ACCEPTED:
|
||||
problem.accepted_number -= 1
|
||||
problem_info = problem.statistic_info
|
||||
problem_info[result] = problem_info.get(result, 0) + 1
|
||||
problem.save(update_fields=["accepted_number", "submission_number", "statistic_info"])
|
||||
|
Loading…
Reference in New Issue
Block a user