Move real_name to UserProfile;
Delete student_id field; Mark the problems that have submission; Alter dispatcher to adapt the changes.
This commit is contained in:
20
submission/migrations/0006_auto_20170830_1154.py
Normal file
20
submission/migrations/0006_auto_20170830_1154.py
Normal file
@@ -0,0 +1,20 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.4 on 2017-08-30 11:54
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('submission', '0005_submission_username'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='submission',
|
||||
name='result',
|
||||
field=models.IntegerField(db_index=True, default=6),
|
||||
),
|
||||
]
|
||||
@@ -27,7 +27,7 @@ class Submission(models.Model):
|
||||
user_id = models.IntegerField(db_index=True)
|
||||
username = models.CharField(max_length=30)
|
||||
code = models.TextField()
|
||||
result = models.IntegerField(default=JudgeStatus.PENDING)
|
||||
result = models.IntegerField(db_index=True, default=JudgeStatus.PENDING)
|
||||
# 判题结果的详细信息
|
||||
info = JSONField(default={})
|
||||
language = models.CharField(max_length=20)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
from account.decorators import login_required, check_contest_permission
|
||||
from judge.tasks import judge_task
|
||||
# from judge.dispatcher import JudgeDispatcher
|
||||
from judge.dispatcher import JudgeDispatcher
|
||||
from problem.models import Problem, ProblemRuleType, ContestProblem
|
||||
from contest.models import Contest, ContestStatus
|
||||
from utils.api import APIView, validate_serializer
|
||||
@@ -104,11 +104,14 @@ class SubmissionListAPI(APIView):
|
||||
|
||||
def process_submissions(self, request, submissions):
|
||||
problem_id = request.GET.get("problem_id")
|
||||
myself = request.GET.get("myself")
|
||||
result = request.GET.get("result")
|
||||
if problem_id:
|
||||
submissions = submissions.filter(problem_id=problem_id)
|
||||
|
||||
if request.GET.get("myself") and request.GET["myself"] == "1":
|
||||
if myself and myself == "1":
|
||||
submissions = submissions.filter(user_id=request.user.id)
|
||||
if result:
|
||||
submissions = submissions.filter(result=result)
|
||||
data = self.paginate_data(request, submissions)
|
||||
data["results"] = SubmissionListSerializer(data["results"], many=True, user=request.user).data
|
||||
return self.success(data)
|
||||
|
||||
Reference in New Issue
Block a user