core: fix naccept on error (#565)

This commit is contained in:
panda authored and GitHub committed 2023-04-22 23:27:47 +08:00
1 parent facbd7fc55
commit 67f0d1d596
1 file changed
+3 -3
+3 -3
View File
@@ -66,14 +66,14 @@ const acm = buildContestRule({
const lockAt = isLocked(tdoc) ? tdoc.lockAt : null; const lockAt = isLocked(tdoc) ? tdoc.lockAt : null;
for (const j of journal) { for (const j of journal) {
if (!this.submitAfterAccept && display[j.pid]?.status === STATUS.STATUS_ACCEPTED) continue; if (!this.submitAfterAccept && display[j.pid]?.status === STATUS.STATUS_ACCEPTED) continue;
if (![STATUS.STATUS_ACCEPTED, STATUS.STATUS_COMPILE_ERROR, STATUS.STATUS_FORMAT_ERROR].includes(j.status)) {
naccept[j.pid]++;
}
const real = Math.floor((j.rid.getTimestamp().getTime() - 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[j.pid] = { detail[j.pid] = {
...j, naccept: naccept[j.pid], time: real + penalty, real, penalty, ...j, naccept: naccept[j.pid], time: real + penalty, real, penalty,
}; };
if (![STATUS.STATUS_ACCEPTED, STATUS.STATUS_COMPILE_ERROR, STATUS.STATUS_FORMAT_ERROR].includes(j.status)) {
naccept[j.pid]++;
}
if (lockAt && j.rid.getTimestamp() > lockAt) { if (lockAt && j.rid.getTimestamp() > lockAt) {
npending[j.pid]++; npending[j.pid]++;
// FIXME this is tricky // FIXME this is tricky