mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
core: fix acm scoreboard
This commit is contained in:
1 parent
ee2ba9c712
commit
a33d8e768f
3 files changed
+33
-10
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "2.33.13",
|
||||
"version": "2.33.14s",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "src/loader",
|
||||
"module": "src/loader",
|
||||
|
||||
@@ -46,7 +46,7 @@ const acm: ContestRule = {
|
||||
let time = 0;
|
||||
for (const j of journal) {
|
||||
if (tdoc.pids.includes(j.pid)
|
||||
&& !(effective[j.pid] && effective[j.pid].accept)) {
|
||||
&& !(effective[j.pid]?.status === STATUS.STATUS_ACCEPTED)) {
|
||||
effective[j.pid] = j;
|
||||
if (![STATUS.STATUS_ACCEPTED, STATUS.STATUS_COMPILE_ERROR].includes(j.status)) {
|
||||
naccept[j.pid] = (naccept[j.pid] || 0) + 1;
|
||||
@@ -127,10 +127,11 @@ const acm: ContestRule = {
|
||||
}
|
||||
for (const pid of tdoc.pids) {
|
||||
const doc = tsddict[pid] || {};
|
||||
const rid = doc.accept ? doc.rid : null;
|
||||
const colAccepted = `${doc.accept ? `${_('Accepted')} ` : ''}${doc.naccept ? ` (-${doc.naccept})` : ''}`;
|
||||
const colTime = doc.accept ? doc.time : '-';
|
||||
const colTimeStr = doc.accept ? misc.formatSeconds(colTime) : '-';
|
||||
const accept = doc.status === STATUS.STATUS_ACCEPTED;
|
||||
const rid = accept ? doc.rid : null;
|
||||
const colAccepted = `${accept ? `${_('Accepted')} ` : ''}${doc.naccept ? ` (-${doc.naccept})` : ''}`;
|
||||
const colTime = accept ? doc.time : '-';
|
||||
const colTimeStr = accept ? misc.formatSeconds(colTime) : '-';
|
||||
if (isExport) {
|
||||
row.push({ type: 'string', value: colAccepted });
|
||||
row.push({ type: 'string', value: colTime });
|
||||
@@ -138,7 +139,7 @@ const acm: ContestRule = {
|
||||
} else {
|
||||
row.push({
|
||||
type: 'record',
|
||||
score: doc.accept ? 100 : 0,
|
||||
score: accept ? 100 : 0,
|
||||
value: '{0}\n{1}'.format(colAccepted, colTimeStr),
|
||||
raw: rid,
|
||||
});
|
||||
@@ -200,7 +201,7 @@ const oi: ContestRule = {
|
||||
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]) {
|
||||
if (tsddict[pid]?.status === STATUS.STATUS_ACCEPTED && tsddict[pid].rid.generationTime < first[pid]) {
|
||||
first[pid] = tsddict[pid].rid.generationTime;
|
||||
}
|
||||
}
|
||||
@@ -261,7 +262,7 @@ const oi: ContestRule = {
|
||||
value: tsddict[pid]?.score ?? '-',
|
||||
raw: tsddict[pid]?.rid || null,
|
||||
};
|
||||
if (tsddict[pid]?.accept && tsddict[pid]?.rid.generationTime === first[pid]) {
|
||||
if (tsddict[pid]?.status === STATUS.STATUS_ACCEPTED && tsddict[pid]?.rid.generationTime === first[pid]) {
|
||||
node.style = 'background-color: rgb(217, 240, 199);';
|
||||
}
|
||||
row.push(node);
|
||||
@@ -291,7 +292,7 @@ const homework: ContestRule = {
|
||||
stat: (tdoc, journal) => {
|
||||
const effective = {};
|
||||
for (const j of journal) {
|
||||
if (tdoc.pids.includes(j.pid) && (!effective[j.pid] || j.accept)) {
|
||||
if (tdoc.pids.includes(j.pid) && (!effective[j.pid] || j.status === STATUS.STATUS_ACCEPTED)) {
|
||||
effective[j.pid] = j;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -493,6 +493,28 @@ const scripts: UpgradeScript[] = [
|
||||
});
|
||||
return true;
|
||||
},
|
||||
async function _43_44() {
|
||||
const _FRESH_INSTALL_IGNORE = 1;
|
||||
const processer = (i) => {
|
||||
i.status = i.accept ? STATUS.STATUS_ACCEPTED : STATUS.STATUS_WRONG_ANSWER;
|
||||
return i;
|
||||
};
|
||||
await iterateAllDomain(async (ddoc) => {
|
||||
const tdocs = await contest.getMulti(ddoc._id, { rule: { $ne: 'acm' } }).toArray();
|
||||
for (const tdoc of tdocs) {
|
||||
const tsdocs = await contest.getMultiStatus(ddoc._id, { docId: tdoc.docId }).toArray();
|
||||
for (const tsdoc of tsdocs) {
|
||||
const $set: any = {};
|
||||
if (tsdoc.journal?.length) $set.journal = tsdoc.journal.map(processer);
|
||||
if (tsdoc.detail?.length) $set.detail = tsdoc.detail.map(processer);
|
||||
if (Object.keys($set).length) {
|
||||
await contest.setStatus(ddoc._id, tdoc.docId, tsdoc.uid, $set);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return true;
|
||||
},
|
||||
];
|
||||
|
||||
export default scripts;
|
||||
Reference in new issue
Block a user