core: bug fix

This commit is contained in:
undefined committed 2021-10-17 17:37:25 +08:00
1 parent ac66e3d7a2
commit f7f977293c
6 files changed
+13 -18

No files matched your search

+2 -8
View File
@@ -29,12 +29,7 @@ async function runProblem(...arg: any[]) {
{
docId: pdoc.docId,
rid: { $ne: null },
uid: {
$nin: [
pdoc.owner,
...system.get('rank.uidIgnore').split(',').map((i) => +i).filter((i) => i),
],
},
uid: { $ne: pdoc.owner },
},
).count() + 99) / 100,
);
@@ -68,7 +63,6 @@ async function runContest(...arg: any[]) {
const cursor = contest.getMultiStatus(tdoc.domainId, {
docId: tdoc.docId,
journal: { $ne: null },
uid: { $nin: system.get('rank.uidIgnore').split(',').map((i) => +i).filter((i) => i) },
}).sort(contest.RULES[tdoc.rule].statusSort);
if (!await cursor.count()) return;
const [rankedTsdocs] = await contest.RULES[tdoc.rule].ranked(tdoc, cursor);
@@ -166,7 +160,7 @@ async function runInDomain(id: string, isSub: boolean, report: Function) {
const tasks = [];
async function update(uid: number, rp: number) {
const udoc = await UserModel.getById(id, +uid);
const $upd: any = { $set: { rp } };
const $upd: any = { $set: { rp: Math.max(0, rp) } };
if (udoc.hasPriv(PRIV.PRIV_USER_PROFILE)) await domain.updateUserInDomain(id, +uid, $upd);
}
for (const uid in udict) tasks.push(update(+uid, udict[uid] + (deltaudict[uid] || 0)));