比赛排名页面提示错误的次数和 AC 的时间
This commit is contained in:
19
contest/migrations/0007_contestsubmission_ac_time.py
Normal file
19
contest/migrations/0007_contestsubmission_ac_time.py
Normal file
@@ -0,0 +1,19 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('contest', '0006_merge'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='contestsubmission',
|
||||
name='ac_time',
|
||||
field=models.IntegerField(default=0),
|
||||
),
|
||||
]
|
||||
@@ -84,6 +84,8 @@ class ContestSubmission(models.Model):
|
||||
total_submission_number = models.IntegerField(default=1)
|
||||
# 这道题是 AC 还是没过
|
||||
ac = models.BooleanField()
|
||||
# ac 用时
|
||||
ac_time = models.IntegerField(default=0)
|
||||
# 总的时间,用于acm 类型的,也需要保存罚时
|
||||
total_time = models.IntegerField(default=0)
|
||||
|
||||
|
||||
@@ -402,8 +402,8 @@ def _cmp(x, y):
|
||||
def contest_rank_page(request, contest_id):
|
||||
contest = Contest.objects.get(id=contest_id)
|
||||
contest_problems = ContestProblem.objects.filter(contest=contest).order_by("sort_index")
|
||||
result = ContestSubmission.objects.filter(contest=contest).values("user_id").annotate(
|
||||
total_submit=Sum("total_submission_number"))
|
||||
result = ContestSubmission.objects.filter(contest=contest).values("user_id").\
|
||||
annotate(total_submit=Sum("total_submission_number"))
|
||||
for i in range(0, len(result)):
|
||||
# 这个人所有的提交
|
||||
submissions = ContestSubmission.objects.filter(user_id=result[i]["user_id"], contest_id=contest_id)
|
||||
|
||||
Reference in New Issue
Block a user