mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: update rating calculation
This commit is contained in:
1 parent
ad3a0c48aa
commit
9b221c4363
2 files changed
+5
-5
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "3.8.1",
|
"version": "3.8.2",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "src/loader",
|
"main": "src/loader",
|
||||||
"module": "src/loader",
|
"module": "src/loader",
|
||||||
|
|||||||
@@ -54,15 +54,15 @@ export const RpTypes: Record<string, RpDef> = {
|
|||||||
contest: {
|
contest: {
|
||||||
async run(domainIds, udict, report) {
|
async run(domainIds, udict, report) {
|
||||||
const contests: Tdoc<30>[] = await contest.getMulti('', { domainId: { $in: domainIds }, rated: true })
|
const contests: Tdoc<30>[] = await contest.getMulti('', { domainId: { $in: domainIds }, rated: true })
|
||||||
.sort({ _id: 1 }).toArray() as any;
|
.limit(10).toArray() as any;
|
||||||
if (contests.length) await report({ message: `Found ${contests.length} contests in ${domainIds[0]}` });
|
if (contests.length) await report({ message: `Found ${contests.length} contests in ${domainIds[0]}` });
|
||||||
for (const tdoc of contests) {
|
for (const tdoc of contests.reverse()) {
|
||||||
const start = Date.now();
|
const start = Date.now();
|
||||||
const cursor = contest.getMultiStatus(tdoc.domainId, {
|
const cursor = contest.getMultiStatus(tdoc.domainId, {
|
||||||
docId: tdoc.docId,
|
docId: tdoc.docId,
|
||||||
journal: { $ne: null },
|
journal: { $ne: null },
|
||||||
}).sort(contest.RULES[tdoc.rule].statusSort);
|
}).sort(contest.RULES[tdoc.rule].statusSort);
|
||||||
if (!await cursor.count()) return;
|
if (!await cursor.count()) continue;
|
||||||
const [rankedTsdocs] = await contest.RULES[tdoc.rule].ranked(tdoc, cursor);
|
const [rankedTsdocs] = await contest.RULES[tdoc.rule].ranked(tdoc, cursor);
|
||||||
const users = rankedTsdocs.map((i) => ({ uid: i[1].uid, rank: i[0], old: udict[i[1].uid] }));
|
const users = rankedTsdocs.map((i) => ({ uid: i[1].uid, rank: i[0], old: udict[i[1].uid] }));
|
||||||
// FIXME sum(rating.new) always less than sum(rating.old)
|
// FIXME sum(rating.new) always less than sum(rating.old)
|
||||||
@@ -77,7 +77,7 @@ export const RpTypes: Record<string, RpDef> = {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
for (const key in udict) udict[key] = udict[key] / 2 - 700;
|
for (const key in udict) udict[key] = max(1, udict[key] / 4 - 375);
|
||||||
},
|
},
|
||||||
hidden: false,
|
hidden: false,
|
||||||
base: 1500,
|
base: 1500,
|
||||||
|
|||||||
Reference in new issue
Block a user