mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: rp: filter banned user
This commit is contained in:
1 parent
038036717e
commit
08585bd3e9
2 files changed
+9
-7
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "2.29.40",
|
"version": "2.29.41",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "dist/loader.js",
|
"main": "dist/loader.js",
|
||||||
"typings": "dist/loader.d.ts",
|
"typings": "dist/loader.d.ts",
|
||||||
|
|||||||
@@ -6,8 +6,9 @@ import db from '../service/db';
|
|||||||
import domain from '../model/domain';
|
import domain from '../model/domain';
|
||||||
import * as contest from '../model/contest';
|
import * as contest from '../model/contest';
|
||||||
import problem from '../model/problem';
|
import problem from '../model/problem';
|
||||||
|
import UserModel from '../model/user';
|
||||||
import record from '../model/record';
|
import record from '../model/record';
|
||||||
import { STATUS } from '../model/builtin';
|
import { PRIV, STATUS } from '../model/builtin';
|
||||||
import rating from '../lib/rating';
|
import rating from '../lib/rating';
|
||||||
import paginate from '../lib/paginate';
|
import paginate from '../lib/paginate';
|
||||||
|
|
||||||
@@ -155,12 +156,13 @@ async function runInDomain(id: string, isSub: boolean, report: Function) {
|
|||||||
}
|
}
|
||||||
await domain.setMultiUserInDomain(id, {}, { rp: 1500 });
|
await domain.setMultiUserInDomain(id, {}, { rp: 1500 });
|
||||||
const tasks = [];
|
const tasks = [];
|
||||||
for (const uid in udict) {
|
async function update(uid: number, rp: number) {
|
||||||
const rp = udict[uid] + (deltaudict[uid] || 0);
|
const udoc = await UserModel.getById(id, +uid);
|
||||||
const update: any = { $set: { rp } };
|
const $upd: any = { $set: { rp } };
|
||||||
if (isSub) update.$push = { ratingHistory: rp };
|
if (isSub) $upd.$push = { ratingHistory: rp };
|
||||||
tasks.push(domain.updateUserInDomain(id, +uid, update));
|
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)));
|
||||||
await Promise.all(tasks);
|
await Promise.all(tasks);
|
||||||
await calcLevel(id, report);
|
await calcLevel(id, report);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user