core: remove ratingHistory

This commit is contained in:
undefined committed 2021-10-10 17:08:09 +08:00
1 parent 5f527658f8
commit fb19c8073f
8 files changed
+11 -77

No files matched your search

+1
View File
@@ -62,6 +62,7 @@ class RecordListHandler extends Handler {
if (status) q.status = status;
if (all) {
this.checkPriv(PRIV.PRIV_MANAGE_ALL_DOMAIN);
delete q.contest;
}
let cursor = record.getMulti(all ? '' : domainId, q).sort('_id', -1);
if (!full) cursor = cursor.project(buildProjection(record.PROJECTION_LIST));
-1
View File
@@ -154,7 +154,6 @@ DomainUserSetting(
Setting('setting_storage', 'rpdelta', 0, 'number', 'RP.delta', null, FLAG_HIDDEN | FLAG_DISABLED),
Setting('setting_storage', 'rank', 0, 'number', 'Rank', null, FLAG_DISABLED | FLAG_HIDDEN),
Setting('setting_storage', 'level', 0, 'number', 'level', null, FLAG_HIDDEN | FLAG_DISABLED),
Setting('setting_storage', 'ratingHistory', [], 'text', 'Rating History', null, FLAG_DISABLED | FLAG_HIDDEN),
);
SystemSetting(
+1 -2
View File
@@ -27,7 +27,7 @@ async function runProblem(...arg: any[]) {
pdoc.domainId, { docId: pdoc.docId, rid: { $ne: null } },
).count() + 99) / 100,
);
const p = (pdoc.difficulty || 5) / (Math.sqrt(Math.sqrt(pdoc.nAccept)) + 1);
const p = (pdoc.difficulty || 5) / (Math.sqrt(Math.sqrt(pdoc.nAccept)) + 1) / 10;
for (let page = 1; page <= nPages; page++) {
const psdocs = await problem.getMultiStatus(
pdoc.domainId, { docId: pdoc.docId, rid: { $ne: null } },
@@ -151,7 +151,6 @@ async function runInDomain(id: string, isSub: boolean, report: Function) {
async function update(uid: number, rp: number) {
const udoc = await UserModel.getById(id, +uid);
const $upd: any = { $set: { rp } };
if (isSub) $upd.$push = { ratingHistory: 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)));
+6
View File
@@ -551,6 +551,12 @@ const scripts: UpgradeScript[] = [
await RecordModel.coll.updateMany({ input: { $exists: true } }, { $set: { contest: new ObjectID('000000000000000000000000') } });
return true;
},
async function _49_50() {
const _FRESH_INSTALL_IGNORE = 1;
await db.collection('user').updateMany({}, { $unset: { ratingHistory: '' } });
await db.collection('domain').updateMany({}, { $unset: { pidCounter: '' } });
return true;
},
];
export default scripts;