mirror of
https://github.com/QingdaoU/OnlineJudge.git
synced 2024-12-28 16:12:13 +00:00
修复sample空格被吃掉的问题;
修复test_id 不对应的问题
This commit is contained in:
parent
727fbf48d8
commit
ffd5943492
@ -2,6 +2,7 @@ from django.utils.timezone import now
|
||||
from django.core.cache import cache
|
||||
from utils.api import APIView, validate_serializer
|
||||
from utils.constants import CacheKey
|
||||
from utils.shortcuts import datetime2str
|
||||
from account.decorators import login_required, check_contest_permission
|
||||
|
||||
from utils.constants import ContestRuleType, ContestStatus
|
||||
@ -31,9 +32,11 @@ class ContestAPI(APIView):
|
||||
return self.error("Invalid parameter, id is required")
|
||||
try:
|
||||
contest = Contest.objects.get(id=id)
|
||||
return self.success(ContestSerializer(contest).data)
|
||||
except Contest.DoesNotExist:
|
||||
return self.error("Contest does not exist")
|
||||
data = ContestSerializer(contest).data
|
||||
data["now"] = datetime2str(now())
|
||||
return self.success(data)
|
||||
|
||||
|
||||
class ContestListAPI(APIView):
|
||||
|
@ -124,12 +124,13 @@ class JudgeDispatcher(object):
|
||||
if not service_url:
|
||||
service_url = settings.DEFAULT_JUDGE_SERVER_SERVICE_URL
|
||||
resp = self._request(urljoin(service_url, "/judge"), data=data)
|
||||
self.submission.info = resp
|
||||
if resp["err"]:
|
||||
self.submission.result = JudgeStatus.COMPILE_ERROR
|
||||
self.submission.statistic_info["err_info"] = resp["data"]
|
||||
self.submission.statistic_info["score"] = 0
|
||||
else:
|
||||
resp["data"].sort(key=lambda x: int(x["test_case"]))
|
||||
self.submission.info = resp
|
||||
self._compute_statistic_info(resp["data"])
|
||||
error_test_case = list(filter(lambda case: case["result"] != 0, resp["data"]))
|
||||
# ACM模式下,多个测试点全部正确则AC,否则取第一个错误的测试点的状态
|
||||
|
@ -12,8 +12,8 @@ class TestCaseUploadForm(forms.Form):
|
||||
|
||||
|
||||
class CreateSampleSerializer(serializers.Serializer):
|
||||
input = serializers.CharField()
|
||||
output = serializers.CharField()
|
||||
input = serializers.CharField(trim_whitespace=False)
|
||||
output = serializers.CharField(trim_whitespace=False)
|
||||
|
||||
|
||||
class CreateTestCaseScoreSerializer(serializers.Serializer):
|
||||
|
Loading…
Reference in New Issue
Block a user