mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: contest: detail fix
This commit is contained in:
1 parent
7e8a90a6b2
commit
a988445597
10 files changed
+10
-31
No files matched your search
@@ -38,7 +38,6 @@ async function _parseDagJson(domainId: string, _dag: string): Promise<Tdoc['dag'
|
||||
node.pids[i] = pdoc.docId;
|
||||
}));
|
||||
}
|
||||
// FIXME no-await-in-loop
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
await Promise.all(tasks);
|
||||
const newNode = {
|
||||
|
||||
@@ -206,7 +206,6 @@ export async function addTailReply(
|
||||
export function getTailReply(
|
||||
domainId: string, drid: ObjectID, drrid: ObjectID,
|
||||
): Promise<[DiscussionReplyDoc, DiscussionTailReplyDoc] | [null, null]> {
|
||||
// @ts-ignore
|
||||
return document.getSub(domainId, document.TYPE_DISCUSSION_REPLY, drid, 'reply', drrid);
|
||||
}
|
||||
|
||||
|
||||
@@ -601,27 +601,18 @@ const scripts: UpgradeScript[] = [
|
||||
doc.domainId, document.TYPE_CONTEST, { docId: doc.docId },
|
||||
).toArray();
|
||||
for (const ctdoc of ctdocs) {
|
||||
const cmark = ctdoc.journal?.filter((i) => isStringPid(i.pid)).length
|
||||
|| ctdoc.detail?.filter((i) => isStringPid(i.pid)).length;
|
||||
if (!cmark) continue;
|
||||
const $set: any = {};
|
||||
if (ctdoc.journal?.filter((i) => isStringPid(i.pid)).length) {
|
||||
$set.journal = await Promise.all(ctdoc.journal.map(async (i) => {
|
||||
if (!ctdoc.journal?.filter((i) => isStringPid(i.pid)).length) continue;
|
||||
const $set = {
|
||||
journal: await Promise.all(ctdoc.journal.map(async (i) => {
|
||||
const pdoc = await getProblem(doc.domainId, i.pid);
|
||||
if (pdoc) i.pid = pdoc.docId;
|
||||
return i;
|
||||
}));
|
||||
}
|
||||
if (ctdoc.detail?.filter((i) => isStringPid(i.pid)).length) {
|
||||
$set.detail = await Promise.all(ctdoc.detail.map(async (i) => {
|
||||
const pdoc = await getProblem(doc.domainId, i.pid);
|
||||
if (pdoc) i.pid = pdoc.docId;
|
||||
return i;
|
||||
}));
|
||||
}
|
||||
})),
|
||||
};
|
||||
await document.setStatus(doc.domainId, doc.docType, doc.docId, ctdoc.uid, $set);
|
||||
}
|
||||
await contest.edit(doc.domainId, doc.docId, { pids });
|
||||
await contest.recalcStatus(doc.domainId, doc.docId);
|
||||
}
|
||||
}
|
||||
await db.collection('record').updateMany({}, { $unset: { pdomain: '' } });
|
||||
|
||||
@@ -8,7 +8,6 @@ export function buildProjection(fields: string[]): Record<string, 1> {
|
||||
|
||||
export const log2 = (val: bigint | number) => {
|
||||
if (typeof val === 'bigint') {
|
||||
// @ts-ignore
|
||||
for (let i = 0n; ; i++) if (!(val >> i)) return +i.toString() - 1;
|
||||
} else {
|
||||
for (let i = 0; ; i++) if (!(val >> i)) return i - 1;
|
||||
|
||||
Reference in new issue
Block a user