Skip to content

Commit db68d25

Browse files
authored
core: support display after contest record score on ioi-strict (#1004)
1 parent e479cb9 commit db68d25

1 file changed

Lines changed: 29 additions & 11 deletions

File tree

packages/hydrooj/src/model/contest.ts

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -502,17 +502,35 @@ const strictioi = buildContestRule({
502502
}
503503
}
504504
for (const pid of tdoc.pids) {
505-
row.push({
506-
type: 'record',
507-
value: ((tsddict[pid]?.score || 0) * ((tdoc.score?.[pid] || 100) / 100)).toString() || '',
508-
hover: Object.values(tsddict[pid]?.subtasks || {}).map((i: SubtaskResult) => `${STATUS_SHORT_TEXTS[i.status]} ${i.score}`).join(','),
509-
raw: tsddict[pid]?.rid,
510-
score: tsddict[pid]?.score,
511-
style: tsddict[pid]?.status === STATUS.STATUS_ACCEPTED
512-
&& tsddict[pid].rid.getTimestamp().getTime() - (tsdoc.startAt || tdoc.beginAt).getTime() === meta?.first?.[pid]
513-
? 'background-color: rgb(217, 240, 199);'
514-
: undefined,
515-
});
505+
const index = `${tsdoc.uid}/${tdoc.domainId}/${pid}`;
506+
const n: ScoreboardNode = (!config.isExport && !config.lockAt && isDone(tdoc)
507+
&& meta?.psdict?.[index]?.rid
508+
&& tsddict[pid]?.rid?.toHexString() !== meta?.psdict?.[index]?.rid?.toHexString()
509+
&& meta?.psdict?.[index]?.rid?.getTimestamp() > tdoc.endAt)
510+
? {
511+
type: 'records',
512+
value: '',
513+
raw: [{
514+
value: ((tsddict[pid]?.score || 0) * ((tdoc.score?.[pid] || 100) / 100)).toString() || '',
515+
raw: tsddict[pid]?.rid || null,
516+
score: tsddict[pid]?.score,
517+
}, {
518+
value: ((meta?.psdict?.[index]?.score || 0) * ((tdoc.score?.[pid] || 100) / 100)).toString() || '',
519+
raw: meta?.psdict?.[index]?.rid ?? null,
520+
score: meta?.psdict?.[index]?.score,
521+
}],
522+
} : {
523+
type: 'record',
524+
value: ((tsddict[pid]?.score || 0) * ((tdoc.score?.[pid] || 100) / 100)).toString() || '',
525+
raw: tsddict[pid]?.rid,
526+
score: tsddict[pid]?.score,
527+
};
528+
n.hover = Object.values(tsddict[pid]?.subtasks || {}).map((i: SubtaskResult) => `${STATUS_SHORT_TEXTS[i.status]} ${i.score}`).join(',');
529+
if (tsddict[pid]?.status === STATUS.STATUS_ACCEPTED
530+
&& tsddict[pid].rid.getTimestamp().getTime() - (tsdoc.startAt || tdoc.beginAt).getTime() === meta?.first?.[pid]) {
531+
n.style = 'background-color: rgb(217, 240, 199);';
532+
}
533+
row.push(n);
516534
}
517535
return row;
518536
},

0 commit comments

Comments
 (0)