mirror of
https://github.com/QingdaoU/OnlineJudge.git
synced 2025-11-04 14:49:58 +08:00
修改rank 页面的bug(对于没有有效时间的用户时间格式转换失败),添加mq对first_achieved的支持
This commit is contained in:
parent
3e583611e3
commit
b4bdf7a669
@ -393,6 +393,8 @@ def _cmp(x, y):
|
|||||||
|
|
||||||
|
|
||||||
def get_the_time_format(seconds):
|
def get_the_time_format(seconds):
|
||||||
|
if not seconds:
|
||||||
|
return ""
|
||||||
result = str(seconds % 60)
|
result = str(seconds % 60)
|
||||||
if seconds % 60 < 10:
|
if seconds % 60 < 10:
|
||||||
result = "0" + result
|
result = "0" + result
|
||||||
|
|||||||
@ -66,6 +66,8 @@ class MessageQueue(object):
|
|||||||
contest_submission.total_time += contest_submission.ac_time
|
contest_submission.total_time += contest_submission.ac_time
|
||||||
contest_submission.total_submission_number += 1
|
contest_submission.total_submission_number += 1
|
||||||
# 标记为已经通过
|
# 标记为已经通过
|
||||||
|
if contest_problem.total_accepted_number == 0:
|
||||||
|
contest_submission.first_achieved = True
|
||||||
contest_submission.ac = True
|
contest_submission.ac = True
|
||||||
# contest problem ac 计数器加1
|
# contest problem ac 计数器加1
|
||||||
contest_problem.total_accepted_number += 1
|
contest_problem.total_accepted_number += 1
|
||||||
@ -81,13 +83,16 @@ class MessageQueue(object):
|
|||||||
if is_ac:
|
if is_ac:
|
||||||
total_time = int((submission.create_time - contest.start_time).total_seconds())
|
total_time = int((submission.create_time - contest.start_time).total_seconds())
|
||||||
# 增加题目总的ac数计数器
|
# 增加题目总的ac数计数器
|
||||||
|
first_achieved = False
|
||||||
|
if contest_problem.total_accepted_number == 0:
|
||||||
|
first_achieved = True
|
||||||
contest_problem.total_accepted_number += 1
|
contest_problem.total_accepted_number += 1
|
||||||
contest_problem.save()
|
contest_problem.save()
|
||||||
else:
|
else:
|
||||||
# 没过罚时20分钟
|
# 没过罚时20分钟
|
||||||
total_time = 1200
|
total_time = 1200
|
||||||
ContestSubmission.objects.create(user_id=submission.user_id, contest=contest, problem=contest_problem,
|
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")
|
logger.debug("Start message queue")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user