diff --git a/contest/views.py b/contest/views.py index 867b999..28bb721 100644 --- a/contest/views.py +++ b/contest/views.py @@ -393,6 +393,8 @@ def _cmp(x, y): def get_the_time_format(seconds): + if not seconds: + return "" result = str(seconds % 60) if seconds % 60 < 10: result = "0" + result diff --git a/mq/scripts/info.py b/mq/scripts/info.py index d36eb49..84040b8 100644 --- a/mq/scripts/info.py +++ b/mq/scripts/info.py @@ -66,6 +66,8 @@ class MessageQueue(object): contest_submission.total_time += contest_submission.ac_time contest_submission.total_submission_number += 1 # 标记为已经通过 + if contest_problem.total_accepted_number == 0: + contest_submission.first_achieved = True contest_submission.ac = True # contest problem ac 计数器加1 contest_problem.total_accepted_number += 1 @@ -81,13 +83,16 @@ class MessageQueue(object): if is_ac: total_time = int((submission.create_time - contest.start_time).total_seconds()) # 增加题目总的ac数计数器 + first_achieved = False + if contest_problem.total_accepted_number == 0: + first_achieved = True contest_problem.total_accepted_number += 1 contest_problem.save() else: # 没过罚时20分钟 total_time = 1200 ContestSubmission.objects.create(user_id=submission.user_id, contest=contest, problem=contest_problem, - ac=is_ac, total_time=total_time) + ac=is_ac, total_time=total_time, first_achieved=first_achieved) logger.debug("Start message queue")