mirror of
https://github.com/QingdaoU/OnlineJudge.git
synced 2025-11-04 14:49:58 +08:00
修改和删除 contest 和 problem 部分字段
This commit is contained in:
parent
6962816053
commit
156be0b21d
@ -22,12 +22,8 @@ CONTEST_UNDERWAY = 0
|
||||
class Contest(models.Model):
|
||||
title = models.CharField(max_length=40, unique=True)
|
||||
description = RichTextField()
|
||||
# 比赛模式:0 即为是acm模式,1 即为是按照总的 ac 题目数量排名模式
|
||||
mode = models.IntegerField()
|
||||
# 是否显示实时排名结果
|
||||
real_time_rank = models.BooleanField()
|
||||
# 是否显示别人的提交记录
|
||||
show_user_submission = models.BooleanField()
|
||||
# 只能超级管理员创建公开赛,管理员只能创建小组内部的比赛
|
||||
# 如果这一项不为空,即为有密码的公开赛,没有密码的可以为小组赛或者是公开赛(此时用比赛的类型来表示)
|
||||
password = models.CharField(max_length=30, blank=True, null=True)
|
||||
@ -68,46 +64,13 @@ class ContestProblem(AbstractProblem):
|
||||
contest = models.ForeignKey(Contest)
|
||||
# 比如A B 或者1 2 或者 a b 将按照这个排序
|
||||
sort_index = models.CharField(max_length=30)
|
||||
score = models.IntegerField(default=0)
|
||||
# 是否已经公开了题目,防止重复公开
|
||||
is_public = models.BooleanField(default=False)
|
||||
|
||||
class Meta:
|
||||
db_table = "contest_problem"
|
||||
|
||||
|
||||
class ContestProblemTestCase(models.Model):
|
||||
"""
|
||||
如果比赛是按照通过的测试用例总分计算的话,就需要这个model 记录每个测试用例的分数
|
||||
"""
|
||||
# 测试用例的id 这个还在测试用例的配置文件里面有对应
|
||||
id = models.CharField(max_length=40, primary_key=True, db_index=True)
|
||||
problem = models.ForeignKey(ContestProblem)
|
||||
score = models.IntegerField()
|
||||
|
||||
class Meta:
|
||||
db_table = "contest_problem_test_case"
|
||||
|
||||
|
||||
class ContestSubmission(models.Model):
|
||||
"""
|
||||
用于保存比赛提交和排名的一些数据,加快检索速度
|
||||
"""
|
||||
user = models.ForeignKey(User)
|
||||
problem = models.ForeignKey(ContestProblem)
|
||||
contest = models.ForeignKey(Contest)
|
||||
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)
|
||||
# 第一个解出此题目
|
||||
first_achieved = models.BooleanField(default=False)
|
||||
|
||||
class Meta:
|
||||
db_table = "contest_submission"
|
||||
|
||||
|
||||
class ContestRank(models.Model):
|
||||
user = models.ForeignKey(User)
|
||||
contest = models.ForeignKey(Contest)
|
||||
|
||||
@ -19,7 +19,7 @@ from account.models import SUPER_ADMIN, User
|
||||
from account.decorators import login_required
|
||||
from group.models import Group
|
||||
from utils.cache import get_cache_redis
|
||||
from .models import (Contest, ContestProblem, ContestSubmission, CONTEST_ENDED,
|
||||
from .models import (Contest, ContestProblem, CONTEST_ENDED,
|
||||
CONTEST_NOT_START, CONTEST_UNDERWAY, ContestRank)
|
||||
from .models import GROUP_CONTEST, PUBLIC_CONTEST, PASSWORD_PROTECTED_CONTEST
|
||||
from .decorators import check_user_contest_permission
|
||||
|
||||
24
problem/migrations/0010_auto_20151017_1226.py
Normal file
24
problem/migrations/0010_auto_20151017_1226.py
Normal file
@ -0,0 +1,24 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('problem', '0009_auto_20151008_1125'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='problem',
|
||||
name='last_update_time',
|
||||
field=models.DateTimeField(null=True, blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='problem',
|
||||
name='source',
|
||||
field=models.CharField(max_length=200, null=True, blank=True),
|
||||
),
|
||||
]
|
||||
20
problem/migrations/0011_auto_20151017_1227.py
Normal file
20
problem/migrations/0011_auto_20151017_1227.py
Normal file
@ -0,0 +1,20 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
import utils.models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('problem', '0010_auto_20151017_1226'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='problem',
|
||||
name='hint',
|
||||
field=utils.models.RichTextField(null=True, blank=True),
|
||||
),
|
||||
]
|
||||
@ -26,11 +26,12 @@ class AbstractProblem(models.Model):
|
||||
# 测试用例id 这个id 可以用来拼接得到测试用例的文件存储位置
|
||||
test_case_id = models.CharField(max_length=40)
|
||||
# 提示
|
||||
hint = models.TextField(blank=True, null=True)
|
||||
hint = RichTextField(blank=True, null=True)
|
||||
# 创建时间
|
||||
create_time = models.DateTimeField(auto_now_add=True)
|
||||
# 最后更新时间
|
||||
# last_update_time = models.DateTimeField(auto_now=True)
|
||||
# 最后更新时间,不适用auto_now,因为本 model 里面的提交数量是变化的,导致每次 last_update_time 也更新了
|
||||
# 需要每次编辑后手动赋值
|
||||
last_update_time = models.DateTimeField(blank=True, null=True)
|
||||
# 这个题是谁创建的
|
||||
created_by = models.ForeignKey(User)
|
||||
# 时间限制 单位是毫秒
|
||||
@ -63,4 +64,4 @@ class Problem(AbstractProblem):
|
||||
# 标签
|
||||
tags = models.ManyToManyField(ProblemTag)
|
||||
# 来源
|
||||
source = models.CharField(max_length=30, blank=True, null=True)
|
||||
source = models.CharField(max_length=200, blank=True, null=True)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user