core: bug fix

pull/549/head
undefined 2 years ago
parent dbd12bd9d9
commit 1b89677456
No known key found for this signature in database

@ -1,6 +1,6 @@
{
"name": "hydrooj",
"version": "4.9.8",
"version": "4.9.9",
"bin": "bin/hydrooj.js",
"main": "src/plugin-api",
"module": "src/plugin-api",

@ -76,6 +76,9 @@ const acm = buildContestRule({
}
if (lockAt && j.rid.getTimestamp() > lockAt) {
npending[j.pid]++;
// FIXME this is tricky
// @ts-ignore
display[j.pid] ||= {};
display[j.pid].npending = npending[j.pid];
continue;
}

@ -23,6 +23,6 @@ export default async (ctx: KoaContext, next) => {
}
ctx.domainId = inferDomain?._id || domainId;
ctx.domainInfo = inferDomain || absoluteDomain;
if (domainId !== ctx.domainInfo._id) ctx.redirect(ctx.originalPath.replace(/^\/d\/[^/]+\//, `/d/${ctx.domainInfo._id}/`));
if (ctx.domainId !== ctx.domainInfo._id) ctx.redirect(ctx.originalPath.replace(/^\/d\/[^/]+\//, `/d/${ctx.domainInfo._id}/`));
else await next();
};

@ -555,6 +555,22 @@ const scripts: UpgradeScript[] = [
await document.coll.updateMany({ docType: document.TYPE_DISCUSSION }, { $set: { hidden: false } });
return true;
},
async function _78_79() {
const t = await document.collStatus.find({
docType: document.TYPE_CONTEST, journal: { $elemMatch: { rid: null } },
}).toArray();
for (const r of t) {
r.journal = r.journal.filter((i) => i.rid !== null);
await document.collStatus.updateOne({ _id: r._id }, { $set: { journal: r.journal } });
}
await iterateAllContest(async (tdoc) => {
if (tdoc.rule !== 'acm') return;
logger.info(tdoc.domainId, tdoc.title);
await contest.recalcStatus(tdoc.domainId, tdoc.docId);
if (contest.isDone(tdoc)) await contest.unlockScoreboard(tdoc.domainId, tdoc.docId);
});
return true;
},
];
export default scripts;

Loading…
Cancel
Save