core: contest: mark zero-scored submission as effective

This commit is contained in:
undefined authored and GitHub committed 2022-04-19 18:54:52 +08:00
1 parent 128668ec63
commit de9426a7fc
2 files changed
+4 -4

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "hydrooj", "name": "hydrooj",
"version": "3.11.19", "version": "3.11.20",
"bin": "bin/hydrooj.js", "bin": "bin/hydrooj.js",
"main": "src/loader", "main": "src/loader",
"module": "src/loader", "module": "src/loader",
+3 -3
View File
@@ -190,7 +190,7 @@ const oi = buildContestRule({
const detail = {}; const detail = {};
let score = 0; let score = 0;
for (const j of journal.filter((i) => tdoc.pids.includes(i.pid))) { 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; for (const i in detail) score += detail[i].score;
return { score, detail }; return { score, detail };
@@ -248,7 +248,7 @@ const oi = buildContestRule({
for (const [rank, tsdoc] of rankedTsdocs) { for (const [rank, tsdoc] of rankedTsdocs) {
const tsddict = {}; const tsddict = {};
for (const item of tsdoc.journal || []) { 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[] = [ const row: ScoreboardNode[] = [
{ type: 'string', value: rank.toString() }, { type: 'string', value: rank.toString() },
@@ -388,7 +388,7 @@ const homework = buildContestRule({
for (const [rank, tsdoc] of rankedTsdocs) { for (const [rank, tsdoc] of rankedTsdocs) {
const tsddict = {}; const tsddict = {};
for (const item of tsdoc.detail || []) { 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 = [ const row: ScoreboardRow = [
{ type: 'string', value: rank }, { type: 'string', value: rank },