MCPcopy Index your code
hub / github.com/hydro-dev/Hydro / run

Function run

packages/hydrooj/src/script/rating.ts:32–53  ·  view source on GitHub ↗
(domainIds, udict, report)

Source from the content-addressed store, hash-verified

30export const RpTypes: Record<string, RpDef> = {
31 problem: {
32 async run(domainIds, udict, report) {
33 const problems = await problem.getMulti('', { domainId: { $in: domainIds }, nAccept: { $gt: 0 }, hidden: false }).toArray();
34 if (problems.length) await report({ message: `Found ${problems.length} problems in ${domainIds[0]}` });
35 for (const pdoc of problems) {
36 const cursor = problem.getMultiStatus(
37 pdoc.domainId,
38 {
39 docId: pdoc.docId,
40 rid: { $ne: null },
41 uid: { $ne: pdoc.owner },
42 score: { $gt: 0 },
43 },
44 );
45 const difficulty = +pdoc.difficulty || difficultyAlgorithm(pdoc.nSubmit, pdoc.nAccept) || 5;
46 const p = difficulty / 100;
47 let psdoc;
48 while (psdoc = await cursor.next()) {
49 udict[psdoc.uid] += min(psdoc.score, 100) * p;
50 }
51 }
52 for (const key in udict) udict[key] = max(0, min(udict[key], log(udict[key]) / log(1.03)));
53 },
54 hidden: false,
55 base: 0,
56 },

Callers

nothing calls this directly

Calls 9

reportFunction · 0.85
difficultyAlgorithmFunction · 0.85
logFunction · 0.85
runInDomainFunction · 0.85
getMultiStatusMethod · 0.80
rankedMethod · 0.80
getMultiUserInDomainMethod · 0.80
getMultiMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected