mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
core: contest: ioi: fix rule context
This commit is contained in:
1 parent
5335763f57
commit
d51c457b7c
2 files changed
+7
-6
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "3.11.13",
|
||||
"version": "3.11.14",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "src/loader",
|
||||
"module": "src/loader",
|
||||
|
||||
@@ -32,9 +32,10 @@ interface AcmDetail extends AcmJournal {
|
||||
}
|
||||
|
||||
function buildContestRule<T>(def: ContestRule<T>): ContestRule<T> {
|
||||
def._originalRule = { scoreboard: def.scoreboard, stat: def.stat };
|
||||
const _originalRule = { scoreboard: def.scoreboard, stat: def.stat };
|
||||
def.scoreboard = (def._originalRule?.scoreboard || def.scoreboard).bind(def);
|
||||
def.stat = (def._originalRule?.stat || def.stat).bind(def);
|
||||
def._originalRule = _originalRule;
|
||||
return def;
|
||||
}
|
||||
|
||||
@@ -189,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]?.status !== STATUS.STATUS_ACCEPTED || this.submitAfterAccept) detail[j.pid] = j;
|
||||
if ((detail[j.pid]?.score || 0) < j.score || this.submitAfterAccept) detail[j.pid] = j;
|
||||
}
|
||||
for (const i in detail) score += detail[i].score;
|
||||
return { score, detail };
|
||||
@@ -246,8 +247,8 @@ const oi = buildContestRule({
|
||||
const rows: ScoreboardNode[][] = [columns];
|
||||
for (const [rank, tsdoc] of rankedTsdocs) {
|
||||
const tsddict = {};
|
||||
if (tsdoc.journal) {
|
||||
for (const item of tsdoc.journal) tsddict[item.pid] = item;
|
||||
for (const item of tsdoc.journal || []) {
|
||||
if ((tsddict[item.pid]?.score || 0) < item.score || this.submitAfterAccept) tsddict[item.pid] = item;
|
||||
}
|
||||
const row: ScoreboardNode[] = [
|
||||
{ type: 'string', value: rank.toString() },
|
||||
@@ -387,7 +388,7 @@ const homework = buildContestRule({
|
||||
for (const [rank, tsdoc] of rankedTsdocs) {
|
||||
const tsddict = {};
|
||||
for (const item of tsdoc.detail || []) {
|
||||
tsddict[item.pid] = item;
|
||||
if ((tsddict[item.pid].score || 0) <= item.score) tsddict[item.pid] = item;
|
||||
}
|
||||
const row: ScoreboardRow = [
|
||||
{ type: 'string', value: rank },
|
||||
|
||||
Reference in new issue
Block a user