core: contest: 显示首A者

This commit is contained in:
undefined committed 2021-07-03 16:41:35 +08:00
1 parent 74cd467bfa
commit f6f714756b
5 files changed
+21 -5

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "hydrooj",
"version": "2.29.15",
"version": "2.29.16",
"bin": "bin/hydrooj.js",
"main": "dist/loader.js",
"typings": "dist/loader.d.ts",
+1
View File
@@ -294,6 +294,7 @@ export interface ScoreboardNode {
value: string;
raw?: any;
score?: number;
style?: string;
}
export type ScoreboardRow = ScoreboardNode[] & { raw?: any };
+17 -2
View File
@@ -179,6 +179,17 @@ const oi: ContestRule = {
}
}
const psdict = {};
const first = {};
for (const pid of tdoc.pids) first[pid] = new ObjectID().generationTime;
for (const [, tsdoc] of rankedTsdocs) {
const tsddict = {};
for (const item of tsdoc.journal || []) tsddict[item.pid] = item;
for (const pid of tdoc.pids) {
if (tsddict[pid]?.accept && tsddict[pid].rid.generationTime < first[pid]) {
first[pid] = tsddict[pid].rid.generationTime;
}
}
}
// eslint-disable-next-line @typescript-eslint/no-use-before-define
if (isDone(tdoc)) {
const psdocs = await Promise.all(
@@ -227,11 +238,15 @@ const oi: ContestRule = {
],
});
} else {
row.push({
const node: ScoreboardNode = {
type: 'record',
value: tsddict[pid]?.score ?? '-',
raw: tsddict[pid]?.rid || null,
});
};
if (tsddict[pid]?.accept && tsddict[pid]?.rid.generationTime === first[pid]) {
node.style = 'background-color: rgb(217, 240, 199);';
}
row.push(node);
}
}
rows.push(row);