From 90283a3944b3455eacb5a95b0f43d030927d1f54 Mon Sep 17 00:00:00 2001 From: undefined Date: Mon, 20 Sep 2021 18:17:00 +0800 Subject: [PATCH] core: fix contest first display --- packages/hydrooj/package.json | 2 +- packages/hydrooj/src/model/contest.ts | 39 ++++++++++++--------------- 2 files changed, 18 insertions(+), 23 deletions(-) diff --git a/packages/hydrooj/package.json b/packages/hydrooj/package.json index 44ffa4f78..2768aef7a 100644 --- a/packages/hydrooj/package.json +++ b/packages/hydrooj/package.json @@ -1,6 +1,6 @@ { "name": "hydrooj", - "version": "2.36.9", + "version": "2.36.10", "bin": "bin/hydrooj.js", "main": "src/loader", "module": "src/loader", diff --git a/packages/hydrooj/src/model/contest.ts b/packages/hydrooj/src/model/contest.ts index 5884d0b2c..e91e9df69 100644 --- a/packages/hydrooj/src/model/contest.ts +++ b/packages/hydrooj/src/model/contest.ts @@ -241,33 +241,28 @@ const oi: ContestRule = { const index = pid.toString().includes(':') ? `${tsdoc.uid}/${pid.toString().replace(':', '/')}` : `${tsdoc.uid}/${tdoc.domainId}/${pid}`; - // eslint-disable-next-line @typescript-eslint/no-use-before-define - if (isDone(tdoc) && tsddict[pid]?.rid?.toHexString() !== psdict[index]?.rid?.toHexString()) { - row.push({ - type: 'records', - value: '', - raw: [ - { + const node: ScoreboardNode = + // eslint-disable-next-line @typescript-eslint/no-use-before-define + isDone(tdoc) && tsddict[pid]?.rid?.toHexString() !== psdict[index]?.rid?.toHexString() + ? { + type: 'records', + value: '', + raw: [{ value: tsddict[pid]?.score ?? '-', raw: tsddict[pid]?.rid || null, - }, - { + }, { value: psdict[index]?.score ?? '-', raw: psdict[index]?.rid ?? null, - }, - ], - }); - } else { - const node: ScoreboardNode = { - type: 'record', - value: tsddict[pid]?.score ?? '-', - raw: tsddict[pid]?.rid || null, - }; - if (tsddict[pid]?.status === STATUS.STATUS_ACCEPTED && tsddict[pid]?.rid.generationTime === first[pid]) { - node.style = 'background-color: rgb(217, 240, 199);'; - } - row.push(node); + }], + } : { + type: 'record', + value: tsddict[pid]?.score ?? '-', + raw: tsddict[pid]?.rid || null, + }; + if (tsddict[pid]?.status === STATUS.STATUS_ACCEPTED && tsddict[pid]?.rid.generationTime === first[pid]) { + node.style = 'background-color: rgb(217, 240, 199);'; } + row.push(node); } rows.push(row); }