From 856ad6d378a9036cb28af91791bc22cc39c356e5 Mon Sep 17 00:00:00 2001 From: "sxw@401" Date: Mon, 14 Sep 2015 21:21:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dac=5Ftime=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=8C=E6=B7=BB=E5=8A=A0first=5Fachieved=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mq/scripts/info.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mq/scripts/info.py b/mq/scripts/info.py index 84040b8..01ef6b2 100644 --- a/mq/scripts/info.py +++ b/mq/scripts/info.py @@ -80,10 +80,12 @@ class MessageQueue(object): except ContestSubmission.DoesNotExist: # 第一次提交 is_ac = submission.result == result["accepted"] + first_achieved = False + ac_time = 0 if is_ac: + ac_time = int((submission.create_time - contest.start_time).total_seconds()) 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 @@ -92,7 +94,8 @@ class MessageQueue(object): # 没过罚时20分钟 total_time = 1200 ContestSubmission.objects.create(user_id=submission.user_id, contest=contest, problem=contest_problem, - ac=is_ac, total_time=total_time, first_achieved=first_achieved) + ac=is_ac, total_time=total_time, first_achieved=first_achieved, + ac_time=ac_time) logger.debug("Start message queue")