mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: fix contest discussion index
This commit is contained in:
1 parent
90283a3944
commit
895b91d8ab
4 files changed
+19
-4
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "2.36.10",
|
"version": "2.36.11",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "src/loader",
|
"main": "src/loader",
|
||||||
"module": "src/loader",
|
"module": "src/loader",
|
||||||
|
|||||||
@@ -241,9 +241,8 @@ const oi: ContestRule = {
|
|||||||
const index = pid.toString().includes(':')
|
const index = pid.toString().includes(':')
|
||||||
? `${tsdoc.uid}/${pid.toString().replace(':', '/')}`
|
? `${tsdoc.uid}/${pid.toString().replace(':', '/')}`
|
||||||
: `${tsdoc.uid}/${tdoc.domainId}/${pid}`;
|
: `${tsdoc.uid}/${tdoc.domainId}/${pid}`;
|
||||||
const node: ScoreboardNode =
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||||
isDone(tdoc) && tsddict[pid]?.rid?.toHexString() !== psdict[index]?.rid?.toHexString()
|
const node: ScoreboardNode = isDone(tdoc) && tsddict[pid]?.rid?.toHexString() !== psdict[index]?.rid?.toHexString()
|
||||||
? {
|
? {
|
||||||
type: 'records',
|
type: 'records',
|
||||||
value: '',
|
value: '',
|
||||||
|
|||||||
@@ -258,7 +258,7 @@ export async function getVnode(domainId: string, type: number, id: string, uid?:
|
|||||||
const tsdoc = await model.getStatus(domainId, _id, uid);
|
const tsdoc = await model.getStatus(domainId, _id, uid);
|
||||||
tdoc.attend = tsdoc?.attend || tsdoc?.enroll;
|
tdoc.attend = tsdoc?.attend || tsdoc?.enroll;
|
||||||
}
|
}
|
||||||
return { ...tdoc, type, id };
|
return { ...tdoc, type, id: _id };
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
...await getNode(domainId, id),
|
...await getNode(domainId, id),
|
||||||
|
|||||||
@@ -519,6 +519,22 @@ const scripts: UpgradeScript[] = [
|
|||||||
await iterateAllUser((udoc) => user.setById(udoc._id, { ip: [udoc.regip] }, { regip: '' }));
|
await iterateAllUser((udoc) => user.setById(udoc._id, { ip: [udoc.regip] }, { regip: '' }));
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
async function _45_46() {
|
||||||
|
const _FRESH_INSTALL_IGNORE = 1;
|
||||||
|
await iterateAllDomain(async (ddoc) => {
|
||||||
|
const ddocs = await discussion.getMulti(ddoc._id, {
|
||||||
|
docType: document.TYPE_DISCUSSION,
|
||||||
|
parentType: { $in: [document.TYPE_CONTEST, document.TYPE_HOMEWORK, document.TYPE_TRAINING] },
|
||||||
|
parentId: { $type: 'string' },
|
||||||
|
}).toArray();
|
||||||
|
for (const doc of ddocs) {
|
||||||
|
if (ObjectID.isValid(doc.parentId)) {
|
||||||
|
await document.set(ddoc._id, document.TYPE_DISCUSSION, doc.docId, { parentId: new ObjectID(doc.parentId) });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export default scripts;
|
export default scripts;
|
||||||
Reference in new issue
Block a user