Comparing version 2.10.27 to 2.10.28
@@ -90,2 +90,4 @@ "use strict"; | ||
const rdoc = await record.get(domainId, rid); | ||
if (!rdoc) | ||
throw new error_1.RecordNotFoundError(rid); | ||
if (rdoc.contest) { | ||
@@ -100,3 +102,3 @@ const tdoc = await contest.get(domainId, rdoc.contest.tid, rdoc.contest.type); | ||
const [pdoc, udoc] = await Promise.all([ | ||
problem.get(domainId, rdoc.pid, null), | ||
problem.get(domainId, rdoc.pid), | ||
user.getById(domainId, rdoc.uid), | ||
@@ -103,0 +105,0 @@ ]); |
@@ -40,3 +40,3 @@ "use strict"; | ||
} | ||
// seems some bug here | ||
// FIXME sum(rating.new) always less than sum(rating.old) | ||
const rated = rating_1.default(users); | ||
@@ -52,4 +52,3 @@ for (const udoc of rated) { | ||
const udict = (typeof arg[0] === 'string') ? arg[2] : arg[1]; | ||
let psdocs = await problem.getMultiStatus(pdoc.domainId, { docId: pdoc.docId }).toArray(); | ||
psdocs = lodash_1.filter(psdocs, (psdoc) => psdoc.rid); | ||
const psdocs = await problem.getMultiStatus(pdoc.domainId, { docId: pdoc.docId, rid: { $ne: null } }).toArray(); | ||
if (!psdocs.length) | ||
@@ -61,4 +60,6 @@ return; | ||
for (const psdoc of psdocs) { | ||
const rp = rdict[psdoc.rid].score * p; | ||
udict[psdoc.uid] = (udict[psdoc.uid] || 1500) + rp; | ||
if (rdict[psdoc.rid]) { | ||
const rp = rdict[psdoc.rid].score * p; | ||
udict[psdoc.uid] = (udict[psdoc.uid] || 1500) + rp; | ||
} | ||
} | ||
@@ -65,0 +66,0 @@ } |
import { ObjectID } from 'mongodb'; | ||
import { PermissionError } from '../error'; | ||
import { PermissionError, RecordNotFoundError } from '../error'; | ||
import { PERM } from '../model/builtin'; | ||
@@ -66,2 +66,3 @@ import * as problem from '../model/problem'; | ||
const rdoc = await record.get(domainId, rid); | ||
if (!rdoc) throw new RecordNotFoundError(rid); | ||
if (rdoc.contest) { | ||
@@ -75,3 +76,3 @@ const tdoc = await contest.get(domainId, rdoc.contest.tid, rdoc.contest.type); | ||
const [pdoc, udoc] = await Promise.all([ | ||
problem.get(domainId, rdoc.pid, null), | ||
problem.get(domainId, rdoc.pid), | ||
user.getById(domainId, rdoc.uid), | ||
@@ -78,0 +79,0 @@ ]); |
@@ -21,3 +21,3 @@ /* eslint-disable no-await-in-loop */ | ||
} | ||
// seems some bug here | ||
// FIXME sum(rating.new) always less than sum(rating.old) | ||
const rated = rating(users); | ||
@@ -36,6 +36,5 @@ for (const udoc of rated) { | ||
const udict: ND = (typeof arg[0] === 'string') ? arg[2] : arg[1]; | ||
let psdocs = await problem.getMultiStatus( | ||
pdoc.domainId, { docId: pdoc.docId }, | ||
const psdocs = await problem.getMultiStatus( | ||
pdoc.domainId, { docId: pdoc.docId, rid: { $ne: null } }, | ||
).toArray(); | ||
psdocs = filter(psdocs, (psdoc) => psdoc.rid); | ||
if (!psdocs.length) return; | ||
@@ -46,4 +45,6 @@ const rdict = await record.getList(pdoc.domainId, psdocs.map((psdoc) => psdoc.rid), true); | ||
for (const psdoc of psdocs) { | ||
const rp = rdict[psdoc.rid].score * p; | ||
udict[psdoc.uid] = (udict[psdoc.uid] || 1500) + rp; | ||
if (rdict[psdoc.rid]) { | ||
const rp = rdict[psdoc.rid].score * p; | ||
udict[psdoc.uid] = (udict[psdoc.uid] || 1500) + rp; | ||
} | ||
} | ||
@@ -50,0 +51,0 @@ } |
{ | ||
"name": "hydrooj", | ||
"version": "2.10.27", | ||
"version": "2.10.28", | ||
"main": "dist/loader.js", | ||
@@ -5,0 +5,0 @@ "bin": "bin/hydrooj.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1421338
24361