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"]],
|
||||
use_sandbox=self._language["use_sandbox"],
|
||||
use_nobody=True)
|
||||
run_result["test_case"] = test_case_id
|
||||
if run_result["flag"] == 0:
|
||||
output_md5, r = self._compare_output(test_case_id)
|
||||
if r:
|
||||
|
@ -17,6 +17,7 @@ from contest.models import ContestProblem, Contest
|
||||
from contest.decorators import check_user_contest_permission
|
||||
from utils.shortcuts import serializer_invalid_response, error_response, success_response, error_page, paginate
|
||||
from utils.throttling import TokenBucket, BucketController
|
||||
from judge.result import result as judge_result
|
||||
from .tasks import _judge
|
||||
from .models import Submission
|
||||
from .serializers import (CreateSubmissionSerializer, SubmissionSerializer,
|
||||
@ -211,13 +212,13 @@ def my_submission(request, submission_id):
|
||||
except Exception:
|
||||
return error_page(request, u"提交不存在")
|
||||
|
||||
if submission.info:
|
||||
try:
|
||||
info = json.loads(submission.info)
|
||||
except Exception:
|
||||
info = submission.info
|
||||
if submission.result in [judge_result["compile_error"], judge_result["system_error"], judge_result["waiting"]]:
|
||||
info = submission.info
|
||||
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)
|
||||
return render(request, "oj/submission/my_submission.html",
|
||||
{"submission": submission, "problem": problem, "info": info,
|
||||
|
@ -59,12 +59,36 @@
|
||||
{% ifequal submission.result 7 %}
|
||||
<pre>System Error: {{ submission.info }}</pre>
|
||||
{% 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 %}
|
||||
|
||||
|
||||
<div id="code-field">
|
||||
<textarea id="code-editor">{{ submission.code }}</textarea>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user