mirror of
https://github.com/QingdaoU/OnlineJudge.git
synced 2025-01-19 19:14:44 +00:00
我的提交列表增加题目名称
This commit is contained in:
parent
593864d4e7
commit
9b5049b89a
@ -165,6 +165,16 @@ def my_submission_list_page(request, page=1):
|
||||
if result:
|
||||
submissions = submissions.filter(result=int(result))
|
||||
filter = {"name": "result", "content": result}
|
||||
|
||||
# 为 submission 查询题目 因为提交页面经常会有重复的题目,缓存一下查询结果
|
||||
cache_result = {}
|
||||
for item in submissions:
|
||||
problem_id = item["problem_id"]
|
||||
if problem_id not in cache_result:
|
||||
problem = Problem.objects.get(id=problem_id)
|
||||
cache_result[problem_id] = problem.title
|
||||
item["title"] = cache_result[problem_id]
|
||||
|
||||
paginator = Paginator(submissions, 20)
|
||||
try:
|
||||
current_page = paginator.page(int(page))
|
||||
|
@ -1,52 +0,0 @@
|
||||
{% extends 'oj_base.html' %}
|
||||
|
||||
{% block body %}
|
||||
|
||||
{% load submission %}
|
||||
<div class="container main">
|
||||
<ul class="nav nav-tabs nav-tabs-google">
|
||||
<li role="presentation">
|
||||
<a href="/problem/{{ problem.id }}/">题目</a></li>
|
||||
<li role="presentation" class="active">
|
||||
<a href="/problem/{{ problem.id }}/submissions/">我的提交</a></li>
|
||||
</ul>
|
||||
{% include "oj/problem/_problem_header.html" %}
|
||||
{% if submissions %}
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr class="" success>
|
||||
<th>#</th>
|
||||
<th>提交时间</th>
|
||||
<th>语言</th>
|
||||
<th>运行时间</th>
|
||||
<th>结果</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for item in submissions %}
|
||||
<tr>
|
||||
<th scope="row"><a href="/submission/{{ item.id }}/">{{ forloop.counter }}</a></th>
|
||||
<td>{{ item.create_time }}</td>
|
||||
<td>
|
||||
{{ item.language|translate_language }}
|
||||
</td>
|
||||
<td>
|
||||
{% if item.accepted_answer_time %}
|
||||
{{ item.accepted_answer_time }}ms
|
||||
{% else %}
|
||||
--
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="alert-{{ item.result|translate_result_class }}">
|
||||
<strong>{{ item.result|translate_result }}</strong>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
<p>你还没有提交该题目</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
@ -52,7 +52,7 @@
|
||||
<a href="/submission/{{ item.id }}/">{{ forloop.counter |add:start_id }}</a>
|
||||
</th>
|
||||
<td>
|
||||
<a href="/problem/{{ item.problem_id }}/">{{ item.problem_id }}</a>
|
||||
<a href="/problem/{{ item.problem_id }}/">{{ item.title }}</a>
|
||||
</td>
|
||||
<td>{{ item.create_time }}</td>
|
||||
<td>
|
||||
|
Loading…
x
Reference in New Issue
Block a user