From 1acd2ff0bbef326bba241e4c5e30071a0ba73dd0 Mon Sep 17 00:00:00 2001 From: undefined Date: Tue, 8 Feb 2022 17:36:18 +0800 Subject: [PATCH] core: contest: oi: fix effective check --- packages/hydrooj/package.json | 2 +- packages/hydrooj/src/model/contest.ts | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/hydrooj/package.json b/packages/hydrooj/package.json index a3b82b331..7fef4bfb9 100644 --- a/packages/hydrooj/package.json +++ b/packages/hydrooj/package.json @@ -1,6 +1,6 @@ { "name": "hydrooj", - "version": "3.4.7", + "version": "3.4.8", "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 9eb130f21..7e51f04aa 100644 --- a/packages/hydrooj/src/model/contest.ts +++ b/packages/hydrooj/src/model/contest.ts @@ -193,7 +193,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]?.status === STATUS.STATUS_ACCEPTED && !this.submitAfterAccept) detail[j.pid] = j; + if (detail[j.pid]?.status !== STATUS.STATUS_ACCEPTED || !this.submitAfterAccept) detail[j.pid] = j; } for (const i in detail) score += detail[i].score; return { score, detail }; @@ -311,9 +311,7 @@ const homework = buildContestRule({ stat: (tdoc, journal) => { const effective = {}; for (const j of journal) { - if (tdoc.pids.includes(j.pid)) { - effective[j.pid] = j; - } + if (tdoc.pids.includes(j.pid)) effective[j.pid] = j; } function time(jdoc) { const real = jdoc.rid.generationTime - tdoc.beginAt.getTime() / 1000;