From f4127a806ae8f14133063b89fcb910b9735c77a5 Mon Sep 17 00:00:00 2001 From: undefined Date: Mon, 12 Dec 2022 03:16:08 +0800 Subject: [PATCH] ui: update pid display --- packages/hydrooj/locales/en.yaml | 2 +- packages/hydrooj/src/handler/contest.ts | 3 ++- .../templates/contest_problemlist.html | 16 ++++++++++------ .../ui-default/templates/problem_detail.html | 2 +- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/packages/hydrooj/locales/en.yaml b/packages/hydrooj/locales/en.yaml index 9620ea65..6c96ad87 100644 --- a/packages/hydrooj/locales/en.yaml +++ b/packages/hydrooj/locales/en.yaml @@ -8,7 +8,7 @@ contest_detail: Contest Detail contest_edit: Contest Edit contest_files: Contest Files contest_main: Contest -contest_problemlist: Proble List +contest_problemlist: Problem List contest_scoreboard: Scoreboard discussion_create: Create Discussion discussion_detail: Discussion Detail diff --git a/packages/hydrooj/src/handler/contest.ts b/packages/hydrooj/src/handler/contest.ts index 615e81cd..2811a121 100644 --- a/packages/hydrooj/src/handler/contest.ts +++ b/packages/hydrooj/src/handler/contest.ts @@ -252,8 +252,9 @@ export class ContestProblemListHandler extends ContestDetailBaseHandler { if (contest.canShowSelfRecord.call(this, this.tdoc)) { [this.response.body.rdict, this.response.body.rdocs] = await Promise.all([ record.getList(domainId, psdocs.map((i: any) => i.rid)), - await record.getMulti(domainId, { tid, uid: this.user._id }).toArray(), + await record.getMulti(domainId, { tid, uid: this.user._id }).sort({ _id: -1 }).toArray(), ]); + this.response.body.canViewRecord = true; } else { for (const i of psdocs) this.response.body.rdict[i.rid] = { _id: i.rid }; } diff --git a/packages/ui-default/templates/contest_problemlist.html b/packages/ui-default/templates/contest_problemlist.html index 11688cdb..742a97e0 100644 --- a/packages/ui-default/templates/contest_problemlist.html +++ b/packages/ui-default/templates/contest_problemlist.html @@ -46,7 +46,9 @@ {% endif %} {% endif %} - {{ problem.render_problem_title(pdict[pid], tdoc=tdoc, show_invisible_flag=false, show_tags=false) }} + + {{ String.fromCharCode(65+loop.index0) }}  {{ pdict[pid].title }} + {%- endfor -%} @@ -54,10 +56,12 @@ -
+
- {% if not rdocs.length %} - {{ nothing.render('Oh, there is no task in the queue!') }} + {% if not canViewRecord %} + {{ nothing.render('According to the contest rules, you cannot view your submission details at current.') }}' + {% elif not rdocs.length %} + {{ nothing.render('Oh, there is no submission!') }} {% else %} @@ -93,8 +97,8 @@
- {% set owner_udoc = udict[tdoc.owner] %} - {% include "partials/contest_sidebar.html" %} + {% set owner_udoc = udict[tdoc.owner] %} + {% include "partials/contest_sidebar.html" %}
{% endblock %} \ No newline at end of file diff --git a/packages/ui-default/templates/problem_detail.html b/packages/ui-default/templates/problem_detail.html index 1563fa6e..3237d79a 100644 --- a/packages/ui-default/templates/problem_detail.html +++ b/packages/ui-default/templates/problem_detail.html @@ -44,7 +44,7 @@ {% endif %} - #{{ pdoc.pid|default(pdoc.docId) }}. {{ pdoc.title }} + #{{ String.fromCharCode(65+tdoc.pids.indexOf(pdoc.docId)) if tdoc else pdoc.pid|default(pdoc.docId) }}. {{ pdoc.title }} {% if tdoc %}