mirror of
https://github.com/QingdaoU/OnlineJudge.git
synced 2024-12-27 23:51:47 +00:00
支持非比赛submission的重判
This commit is contained in:
parent
4e80ac9492
commit
a1eed315b4
@ -9,8 +9,9 @@ urlpatterns = [
|
||||
url(r"^api/admin/", include("conf.urls.admin")),
|
||||
url(r"^api/", include("problem.urls.oj")),
|
||||
url(r"^api/admin/", include("problem.urls.admin")),
|
||||
url(r"^api/admin/", include("contest.urls.admin")),
|
||||
url(r"^api/", include("contest.urls.oj")),
|
||||
url(r"^api/admin/", include("contest.urls.admin")),
|
||||
url(r"^api/", include("submission.urls.oj")),
|
||||
url(r"^api/admin/", include("submission.urls.admin")),
|
||||
url(r"^api/admin/", include("utils.urls")),
|
||||
]
|
||||
|
@ -0,0 +1,7 @@
|
||||
from django.conf.urls import url
|
||||
|
||||
from ..views.admin import SubmissionRejudgeAPI
|
||||
|
||||
urlpatterns = [
|
||||
url(r"^submission/rejudge?$", SubmissionRejudgeAPI.as_view(), name="submission_rejudge_api"),
|
||||
]
|
@ -0,0 +1,24 @@
|
||||
from account.decorators import super_admin_required
|
||||
from judge.tasks import judge_task
|
||||
# from judge.dispatcher import JudgeDispatcher
|
||||
from utils.api import APIView
|
||||
from ..models import Submission, JudgeStatus
|
||||
|
||||
|
||||
class SubmissionRejudgeAPI(APIView):
|
||||
@super_admin_required
|
||||
def get(self, request):
|
||||
id = request.GET.get("id")
|
||||
if not id:
|
||||
return self.error("Paramater error, id is required")
|
||||
try:
|
||||
submission = Submission.objects.select_related("problem").get(id=id, contest_id__isnull=True)
|
||||
except Submission.DoesNotExist:
|
||||
return self.error("Submission does not exists")
|
||||
submission.result = JudgeStatus.PENDING
|
||||
submission.info = {}
|
||||
submission.statistic_info = {}
|
||||
submission.save()
|
||||
|
||||
judge_task.delay(submission.id, submission.problem.id)
|
||||
return self.success()
|
@ -206,6 +206,6 @@ class SubmissionExistsAPI(APIView):
|
||||
def get(self, request):
|
||||
if not request.GET.get("problem_id"):
|
||||
return self.error("Parameter error, problem_id is required")
|
||||
return self.success(request.user.is_authenticated and
|
||||
return self.success(request.user.is_authenticated() and
|
||||
Submission.objects.filter(problem_id=request.GET["problem_id"],
|
||||
user_id=request.user.id).exists())
|
||||
|
Loading…
Reference in New Issue
Block a user