diff --git a/packages/hydrooj/package.json b/packages/hydrooj/package.json index 20839dc43..2bd69b5e4 100644 --- a/packages/hydrooj/package.json +++ b/packages/hydrooj/package.json @@ -1,6 +1,6 @@ { "name": "hydrooj", - "version": "3.11.19", + "version": "3.11.20", "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 deecc42c2..4e355638d 100644 --- a/packages/hydrooj/src/model/contest.ts +++ b/packages/hydrooj/src/model/contest.ts @@ -190,7 +190,7 @@ const oi = buildContestRule({ const detail = {}; let score = 0; for (const j of journal.filter((i) => tdoc.pids.includes(i.pid))) { - if ((detail[j.pid]?.score || 0) < j.score || this.submitAfterAccept) detail[j.pid] = j; + if (!detail[j.pid] || detail[j.pid].score < j.score || this.submitAfterAccept) detail[j.pid] = j; } for (const i in detail) score += detail[i].score; return { score, detail }; @@ -248,7 +248,7 @@ const oi = buildContestRule({ for (const [rank, tsdoc] of rankedTsdocs) { const tsddict = {}; for (const item of tsdoc.journal || []) { - if ((tsddict[item.pid]?.score || 0) < item.score || this.submitAfterAccept) tsddict[item.pid] = item; + if (!tsddict[item.pid] || tsddict[item.pid].score < item.score || this.submitAfterAccept) tsddict[item.pid] = item; } const row: ScoreboardNode[] = [ { type: 'string', value: rank.toString() }, @@ -388,7 +388,7 @@ const homework = buildContestRule({ for (const [rank, tsdoc] of rankedTsdocs) { const tsddict = {}; for (const item of tsdoc.detail || []) { - if ((tsddict[item.pid]?.score || 0) <= item.score) tsddict[item.pid] = item; + if (!tsddict[item.pid] || tsddict[item.pid].score <= item.score) tsddict[item.pid] = item; } const row: ScoreboardRow = [ { type: 'string', value: rank },