修改rank 页面的bug(对于没有有效时间的用户时间格式转换失败),添加mq对first_achieved的支持
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user