From b4bdf7a669c6a4abc8f64c3f018db2de0e73a918 Mon Sep 17 00:00:00 2001 From: "sxw@401" Date: Mon, 14 Sep 2015 20:51:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9rank=20=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E7=9A=84bug(=E5=AF=B9=E4=BA=8E=E6=B2=A1=E6=9C=89=E6=9C=89?= =?UTF-8?q?=E6=95=88=E6=97=B6=E9=97=B4=E7=9A=84=E7=94=A8=E6=88=B7=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E6=A0=BC=E5=BC=8F=E8=BD=AC=E6=8D=A2=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?),=E6=B7=BB=E5=8A=A0mq=E5=AF=B9first=5Fachieved=E7=9A=84?= =?UTF-8?q?=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contest/views.py | 2 ++ mq/scripts/info.py | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) 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")