core: auto-convert contest problem id

This commit is contained in:
undefined committed 2021-07-18 22:43:42 +08:00
1 parent 1f15d78fe6
commit bd9840cc45
4 files changed
+14 -13

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "hydrooj",
"version": "2.29.28",
"version": "2.29.29",
"bin": "bin/hydrooj.js",
"main": "dist/loader.js",
"typings": "dist/loader.d.ts",
+1
View File
@@ -225,6 +225,7 @@ export class ContestEditHandler extends Handler {
const pids = _pids.replace(/,/g, ',').split(',').map((i) => {
i = i.trim();
if ((+i).toString() === i) return +i;
if (i.split(':')[0] === domainId) return +i.split(':')[1];
return i;
}).filter((i) => i);
const beginAtMoment = moment.tz(`${beginAtDate} ${beginAtTime}`, this.user.timeZone);
+1
View File
@@ -312,6 +312,7 @@ class HomeworkEditHandler extends Handler {
const pids = _pids.replace(/,/g, ',').split(',').map((i) => {
i = i.trim();
if ((+i).toString() === i) return +i;
if (i.split(':')[0] === domainId) return +i.split(':')[1];
return i;
}).filter((i) => i);
const tdoc = tid
@@ -41,22 +41,21 @@
<tbody>
{%- for pid in tdoc.pids -%}
<tr>
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
{% if psdict[pid] and psdict[pid]['rid'] %}
{% set rdoc = rdict[psdict[pid]['rid']] %}
{% if model.contest.canShowRecord.call(handler, tdoc) %}
{{ record.render_status_td(rdoc) }}
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
{% if psdict[pid] and psdict[pid].rid %}
{% set rdoc = rdict[psdict[pid].rid] %}
{% if model.contest.canShowRecord.call(handler, tdoc) %}
{{ record.render_status_td(rdoc) }}
{% else %}
<td class="col--status record-status--border"><a href="{{ url('record_detail', rid=rdoc._id) }}">{{ _('Submitted') }}</a></td>
{% endif %}
<td class="col--submit-at">{{ datetimeSpan(rdoc._id)|safe }}</td>
{% else %}
<td class="col--status record-status--border"><a href="{{ url('record_detail', rid=rdoc._id) }}">{{ _('Submitted') }}</a></td>
<td class="col--status record-status--border">{{ _('No Submissions') }}</td>
<td class="col--submit-at">-</td>
{% endif %}
<td class="col--submit-at">{{ datetimeSpan(rdoc['_id'])|safe }}</td>
{% else %}
<td class="col--status record-status--border">{{ _('No Submissions') }}</td>
<td class="col--submit-at">-</td>
{% endif %}
{% endif %}
<td class="col--problem col--problem-name">
#{{ loop.index }}:
{{ problem.render_problem_title(pdict[pid], tdoc=tdoc, show_invisible_flag=false, show_tags=false) }}
</td>
</tr>