mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: skip if no record selected to rejudge
This commit is contained in:
1 file changed
+9
-7
@@ -395,19 +395,21 @@ export class ProblemDetailHandler extends ContestDetailBaseHandler {
|
|||||||
@param('pid', Types.UnsignedInt)
|
@param('pid', Types.UnsignedInt)
|
||||||
async postRejudge(domainId: string, pid: number) {
|
async postRejudge(domainId: string, pid: number) {
|
||||||
this.checkPerm(PERM.PERM_REJUDGE_PROBLEM);
|
this.checkPerm(PERM.PERM_REJUDGE_PROBLEM);
|
||||||
|
if (!this.pdoc.config || typeof this.pdoc.config === 'string') throw new ProblemConfigError();
|
||||||
const rdocs = await record.getMulti(domainId, {
|
const rdocs = await record.getMulti(domainId, {
|
||||||
pid,
|
pid,
|
||||||
contest: { $nin: [record.RECORD_GENERATE, record.RECORD_PRETEST] },
|
contest: { $nin: [record.RECORD_GENERATE, record.RECORD_PRETEST] },
|
||||||
status: { $ne: STATUS.STATUS_CANCELED },
|
status: { $ne: STATUS.STATUS_CANCELED },
|
||||||
'files.hack': { $exists: false },
|
'files.hack': { $exists: false },
|
||||||
}).project({ _id: 1, contest: 1 }).toArray();
|
}).project({ _id: 1, contest: 1 }).toArray();
|
||||||
if (!this.pdoc.config || typeof this.pdoc.config === 'string') throw new ProblemConfigError();
|
if (rdocs.length) {
|
||||||
const priority = await record.submissionPriority(this.user._id, -10000 - rdocs.length * 5 - 50);
|
const priority = await record.submissionPriority(this.user._id, -10000 - rdocs.length * 5 - 50);
|
||||||
await record.reset(domainId, rdocs.map((rdoc) => rdoc._id), true);
|
await record.reset(domainId, rdocs.map((rdoc) => rdoc._id), true);
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
record.judge(domainId, rdocs.filter((i) => i.contest).map((i) => i._id), priority, { detail: false }, { rejudge: true }),
|
record.judge(domainId, rdocs.filter((i) => i.contest).map((i) => i._id), priority, { detail: false }, { rejudge: true }),
|
||||||
record.judge(domainId, rdocs.filter((i) => !i.contest).map((i) => i._id), priority, {}, { rejudge: true }),
|
record.judge(domainId, rdocs.filter((i) => !i.contest).map((i) => i._id), priority, {}, { rejudge: true }),
|
||||||
]);
|
]);
|
||||||
|
}
|
||||||
this.back();
|
this.back();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user