diff --git a/contest_submission/views.py b/contest_submission/views.py index 765d116..6c0edb3 100644 --- a/contest_submission/views.py +++ b/contest_submission/views.py @@ -120,12 +120,15 @@ def contest_problem_submissions_list_page(request, contest_id, page=1): except Exception: pass - # 如果该用户是超级管理员那么他可以查看所有的提交记录详情 - if request.user.admin_type > 1: - return render(request, "oj/contest/submissions_list_admin.html", - {"submissions": current_page, "page": int(page), - "previous_page": previous_page, "next_page": next_page, "start_id": int(page) * 20 - 20, - "contest": contest}) + for item in current_page: + if item.user_id == request.user.id: + setattr(item, "show_link", True) + elif request.user.admin_type == SUPER_ADMIN or request.user: + setattr(item, "show_link", True) + elif request.user == contest.created_by: + setattr(item, "show_link", True) + else: + setattr(item, "show_link", False) return render(request, "oj/contest/submissions_list.html", {"submissions": current_page, "page": int(page), diff --git a/template/src/oj/contest/submissions_list.html b/template/src/oj/contest/submissions_list.html index 1424bb1..973f2e2 100644 --- a/template/src/oj/contest/submissions_list.html +++ b/template/src/oj/contest/submissions_list.html @@ -21,58 +21,59 @@ -
| # | -题目名称 | -用户 | -提交时间 | -
-
-
- 语言
-
-
-
- |
- 运行时间 | -
-
-
- 结果
-
-
-
- |
-
|---|
| # | +题目名称 | +用户 | +提交时间 | +
+
+
+ 语言
+
+
+
+ |
+ 运行时间 | +
+
+
+ 结果
+
+
+
+ |
+
|---|---|---|---|---|---|---|
| - {{ forloop.counter |add:start_id }} | - {% else %} -{{ forloop.counter |add:start_id }} | - {% endifequal %} ++ {% if item.show_link %} + {{ forloop.counter |add:start_id }} + {% else %} + {{ forloop.counter |add:start_id }} + {% endif %} + | {{ item.title }} | @@ -94,10 +95,10 @@
本场比赛还没有提交记录
+ {% endif %} +