mirror of
https://github.com/QingdaoU/OnlineJudge.git
synced 2025-01-17 01:54:52 +00:00
判题结果按照测试用例排序列表显示
This commit is contained in:
parent
cf2fc9df1a
commit
951744a7cd
@ -93,6 +93,7 @@ class JudgeClient(object):
|
|||||||
env=["PATH=" + os.environ["PATH"]],
|
env=["PATH=" + os.environ["PATH"]],
|
||||||
use_sandbox=self._language["use_sandbox"],
|
use_sandbox=self._language["use_sandbox"],
|
||||||
use_nobody=True)
|
use_nobody=True)
|
||||||
|
run_result["test_case"] = test_case_id
|
||||||
if run_result["flag"] == 0:
|
if run_result["flag"] == 0:
|
||||||
output_md5, r = self._compare_output(test_case_id)
|
output_md5, r = self._compare_output(test_case_id)
|
||||||
if r:
|
if r:
|
||||||
|
@ -17,6 +17,7 @@ from contest.models import ContestProblem, Contest
|
|||||||
from contest.decorators import check_user_contest_permission
|
from contest.decorators import check_user_contest_permission
|
||||||
from utils.shortcuts import serializer_invalid_response, error_response, success_response, error_page, paginate
|
from utils.shortcuts import serializer_invalid_response, error_response, success_response, error_page, paginate
|
||||||
from utils.throttling import TokenBucket, BucketController
|
from utils.throttling import TokenBucket, BucketController
|
||||||
|
from judge.result import result as judge_result
|
||||||
from .tasks import _judge
|
from .tasks import _judge
|
||||||
from .models import Submission
|
from .models import Submission
|
||||||
from .serializers import (CreateSubmissionSerializer, SubmissionSerializer,
|
from .serializers import (CreateSubmissionSerializer, SubmissionSerializer,
|
||||||
@ -211,13 +212,13 @@ def my_submission(request, submission_id):
|
|||||||
except Exception:
|
except Exception:
|
||||||
return error_page(request, u"提交不存在")
|
return error_page(request, u"提交不存在")
|
||||||
|
|
||||||
if submission.info:
|
if submission.result in [judge_result["compile_error"], judge_result["system_error"], judge_result["waiting"]]:
|
||||||
try:
|
info = submission.info
|
||||||
info = json.loads(submission.info)
|
|
||||||
except Exception:
|
|
||||||
info = submission.info
|
|
||||||
else:
|
else:
|
||||||
info = None
|
info = json.loads(submission.info)
|
||||||
|
if "test_case" in info[0]:
|
||||||
|
info = sorted(info, key=lambda x: x["test_case"])
|
||||||
|
|
||||||
user = User.objects.get(id=submission.user_id)
|
user = User.objects.get(id=submission.user_id)
|
||||||
return render(request, "oj/submission/my_submission.html",
|
return render(request, "oj/submission/my_submission.html",
|
||||||
{"submission": submission, "problem": problem, "info": info,
|
{"submission": submission, "problem": problem, "info": info,
|
||||||
|
@ -59,12 +59,36 @@
|
|||||||
{% ifequal submission.result 7 %}
|
{% ifequal submission.result 7 %}
|
||||||
<pre>System Error: {{ submission.info }}</pre>
|
<pre>System Error: {{ submission.info }}</pre>
|
||||||
{% else %}
|
{% else %}
|
||||||
<pre>{{ info }}</pre>
|
{% ifequal submission.result 4 %}
|
||||||
|
<pre>Compile error: {{ info }}</pre>
|
||||||
|
{% else %}
|
||||||
|
{% ifequal submission.result 8 %}
|
||||||
|
<pre>Waiting</pre>
|
||||||
|
{% else %}
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>测试用例</th>
|
||||||
|
<th>CPU时间</th>
|
||||||
|
<th>内存</th>
|
||||||
|
<th>结果</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for item in info %}
|
||||||
|
<tr>
|
||||||
|
<th scope="row">{{ item.test_case }}</th>
|
||||||
|
<td>{{ item.cpu_time }} ms</td>
|
||||||
|
<td>{{ item.memory }} Byte</td>
|
||||||
|
<td class="{{ item.result|translate_result_class }}">{{ item.result|translate_result }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{% endifequal %}
|
||||||
|
{% endifequal %}
|
||||||
{% endifequal %}
|
{% endifequal %}
|
||||||
|
|
||||||
{% endifequal %}
|
{% endifequal %}
|
||||||
|
|
||||||
|
|
||||||
<div id="code-field">
|
<div id="code-field">
|
||||||
<textarea id="code-editor">{{ submission.code }}</textarea>
|
<textarea id="code-editor">{{ submission.code }}</textarea>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user