core: bug fix

This commit is contained in:
undefined committed 2023-04-02 03:07:41 +08:00
1 parent dbd12bd9d9
commit 1b89677456
4 files changed
+21 -2

No files matched your search

+1 -1
View File
@@ -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",
+3
View File
@@ -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();
};
+16
View File
@@ -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;