mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: contest: fix pending display
This commit is contained in:
1 parent
9da8321677
commit
105bcbd118
2 files changed
+14
-13
No files matched your search
@@ -70,7 +70,7 @@ const acm = buildContestRule({
|
|||||||
}
|
}
|
||||||
for (const pid in effective) {
|
for (const pid in effective) {
|
||||||
const j = effective[pid];
|
const j = effective[pid];
|
||||||
const real = j.rid.generationTime - Math.floor(tdoc.beginAt.getTime() / 1000);
|
const real = Math.floor((j.rid.getTimestamp().getTime() - tdoc.beginAt.getTime()) / 1000);
|
||||||
const penalty = 20 * 60 * naccept[j.pid];
|
const penalty = 20 * 60 * naccept[j.pid];
|
||||||
detail[pid] = {
|
detail[pid] = {
|
||||||
...j, naccept: naccept[j.pid], time: real + penalty, real, penalty,
|
...j, naccept: naccept[j.pid], time: real + penalty, real, penalty,
|
||||||
@@ -143,7 +143,8 @@ const acm = buildContestRule({
|
|||||||
for (const pid of tdoc.pids) {
|
for (const pid of tdoc.pids) {
|
||||||
const doc = tsddict[pid] || {} as Partial<AcmDetail>;
|
const doc = tsddict[pid] || {} as Partial<AcmDetail>;
|
||||||
const accept = doc.status === STATUS.STATUS_ACCEPTED;
|
const accept = doc.status === STATUS.STATUS_ACCEPTED;
|
||||||
const colTime = accept ? formatSeconds(doc.real, false).toString() : '';
|
const pending = doc.status === STATUS.STATUS_WAITING;
|
||||||
|
const colTime = pending ? '?' : accept ? formatSeconds(doc.real, false).toString() : '';
|
||||||
const colPenalty = doc.rid ? Math.ceil(doc.penalty / 60).toString() : '';
|
const colPenalty = doc.rid ? Math.ceil(doc.penalty / 60).toString() : '';
|
||||||
if (isExport) {
|
if (isExport) {
|
||||||
row.push(
|
row.push(
|
||||||
@@ -151,17 +152,18 @@ const acm = buildContestRule({
|
|||||||
{ type: 'string', value: colPenalty },
|
{ type: 'string', value: colPenalty },
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
let value = '';
|
||||||
|
if (doc.rid) value = `-${doc.naccept}`;
|
||||||
|
if (accept) value = `${doc.naccept ? `+${doc.naccept}` : '<span class="icon icon-check"></span>'}\n${colTime}`;
|
||||||
|
if (pending) value = `<span style="color:blue">${doc.naccept}?</span>`;
|
||||||
row.push({
|
row.push({
|
||||||
type: 'record',
|
type: 'record',
|
||||||
score: accept ? 100 : 0,
|
score: accept ? 100 : 0,
|
||||||
value: accept
|
value,
|
||||||
? `${doc.naccept ? `+${doc.naccept}` : '<span class="icon icon-check"></span>'}\n${colTime}`
|
|
||||||
: doc.rid
|
|
||||||
? `-${doc.naccept}`
|
|
||||||
: '',
|
|
||||||
hover: accept ? formatSeconds(doc.time) : '',
|
hover: accept ? formatSeconds(doc.time) : '',
|
||||||
raw: doc.rid,
|
raw: doc.rid,
|
||||||
style: accept && doc.rid.generationTime === meta?.first?.[pid]
|
style: pending ? 'background-color: yellow'
|
||||||
|
: accept && doc.rid.generationTime === meta?.first?.[pid]
|
||||||
? 'background-color: rgb(217, 240, 199);'
|
? 'background-color: rgb(217, 240, 199);'
|
||||||
: undefined,
|
: undefined,
|
||||||
});
|
});
|
||||||
@@ -560,7 +562,10 @@ export async function getStatus(domainId: string, tid: ObjectID, uid: number) {
|
|||||||
|
|
||||||
async function _updateStatus(tdoc: Tdoc<30>, uid: number, rid: ObjectID, pid: number, status: STATUS, score: number) {
|
async function _updateStatus(tdoc: Tdoc<30>, uid: number, rid: ObjectID, pid: number, status: STATUS, score: number) {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||||
if (isLocked(tdoc)) status = STATUS.STATUS_WAITING;
|
if (isLocked(tdoc)) {
|
||||||
|
status = STATUS.STATUS_WAITING;
|
||||||
|
score = 0;
|
||||||
|
}
|
||||||
const tsdoc = await document.revPushStatus(tdoc.domainId, document.TYPE_CONTEST, tdoc.docId, uid, 'journal', {
|
const tsdoc = await document.revPushStatus(tdoc.domainId, document.TYPE_CONTEST, tdoc.docId, uid, 'journal', {
|
||||||
rid, pid, status, score,
|
rid, pid, status, score,
|
||||||
}, 'rid');
|
}, 'rid');
|
||||||
|
|||||||
@@ -5,12 +5,8 @@
|
|||||||
|
|
||||||
{% macro renderRecord(cell, canView) %}
|
{% macro renderRecord(cell, canView) %}
|
||||||
<a href="{{ url('record_detail', rid=cell.raw) if canView else '' }}"{% if cell.hover %} data-tooltip="{{ cell.hover }}"{% endif %}>
|
<a href="{{ url('record_detail', rid=cell.raw) if canView else '' }}"{% if cell.hover %} data-tooltip="{{ cell.hover }}"{% endif %}>
|
||||||
{%- if cell.status == STATUS.STATUS_WAITING -%}
|
|
||||||
<span style="font-weight:bold;color:yellow">?</span>
|
|
||||||
{%- else -%}
|
|
||||||
{%- set _color = utils.status.getScoreColor(cell.score|default(cell.value)) -%}
|
{%- set _color = utils.status.getScoreColor(cell.score|default(cell.value)) -%}
|
||||||
<span style="font-weight:bold;color:{{ _color }}">{{ cell.value|string|nl2br|safe }}</span>
|
<span style="font-weight:bold;color:{{ _color }}">{{ cell.value|string|nl2br|safe }}</span>
|
||||||
{%- endif -%}
|
|
||||||
</a>
|
</a>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user