Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pandadtdyy committed Sep 19, 2023
1 parent 8a53187 commit 53ed092
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/hydrooj/src/upgrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -620,9 +620,10 @@ const scripts: UpgradeScript[] = [
return await iterateAllDomain(async ({ _id }) => {
const cursor = discussion.getMulti(_id, { parentType: document.TYPE_CONTEST });
for await (const ddoc of cursor) {
await discussion.edit(_id, ddoc.docId, { parentId: new ObjectId(ddoc.parentId) });
const parentId = new ObjectId(ddoc.parentId);
await discussion.edit(_id, ddoc.docId, { parentId });
try {
await contest.get(_id, ddoc.parentId as ObjectId);
await contest.get(_id, parentId);
} catch (e) {
await discussion.del(_id, ddoc.docId);
}
Expand Down

0 comments on commit 53ed092

Please sign in to comment.