core: check contest info when rejudge

This commit is contained in:
undefined committed 2022-04-09 15:13:43 +08:00
1 parent 0b77ed6b76
commit 5335763f57
2 files changed
+4 -3

No files matched your search

+2 -2
View File
@@ -413,11 +413,11 @@ export class ProblemDetailHandler extends ProblemHandler {
this.checkPerm(PERM.PERM_REJUDGE_PROBLEM); this.checkPerm(PERM.PERM_REJUDGE_PROBLEM);
// TODO maybe async? // TODO maybe async?
const rdocs = await record.getMulti(domainId, { pid, contest: { $ne: new ObjectID('0'.repeat(24)) } }) const rdocs = await record.getMulti(domainId, { pid, contest: { $ne: new ObjectID('0'.repeat(24)) } })
.project({ _id: 1 }).toArray(); .project({ _id: 1, contest: 1 }).toArray();
const priority = await record.submissionPriority(this.user._id, -rdocs.length * 5 - 50); const priority = await record.submissionPriority(this.user._id, -rdocs.length * 5 - 50);
await Promise.all(rdocs.map( await Promise.all(rdocs.map(
(doc) => record.reset(domainId, doc._id, true) (doc) => record.reset(domainId, doc._id, true)
.then(() => record.judge(domainId, doc._id, priority)), .then(() => record.judge(domainId, doc._id, priority, doc.contest ? { detail: false } : {})),
)); ));
this.back(); this.back();
} }
+2 -1
View File
@@ -162,8 +162,9 @@ class RecordDetailHandler extends Handler {
const priority = await record.submissionPriority(this.user._id, -20); const priority = await record.submissionPriority(this.user._id, -20);
const rdoc = await record.get(domainId, rid); const rdoc = await record.get(domainId, rid);
if (rdoc) { if (rdoc) {
const isContest = rdoc.contest && rdoc.contest.toHexString() !== '000000000000000000000000';
await record.reset(domainId, rid, true); await record.reset(domainId, rid, true);
await record.judge(domainId, rid, priority); await record.judge(domainId, rid, priority, isContest ? { detail: false } : {});
} }
this.back(); this.back();
} }