(domainIds, udict, report)
| 30 | export 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 | }, |
nothing calls this directly
no test coverage detected