mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
core: add problem config validity check before rejudge
This commit is contained in:
1 parent
632760bedc
commit
e3e89ca43f
2 files changed
+5
-1
No files matched your search
@@ -444,6 +444,7 @@ export class ProblemDetailHandler extends ContestDetailBaseHandler {
|
||||
contest: { $ne: new ObjectID('0'.repeat(24)) },
|
||||
'files.hack': { $exists: false },
|
||||
}).project({ _id: 1, contest: 1 }).toArray();
|
||||
if (!this.pdoc.config || typeof this.pdoc.config === 'string') throw new ProblemConfigError();
|
||||
const priority = await record.submissionPriority(this.user._id, -10000 - rdocs.length * 5 - 50);
|
||||
await record.reset(domainId, rdocs.map((rdoc) => rdoc._id), true);
|
||||
await Promise.all([
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { omit, pick, throttle } from 'lodash';
|
||||
import { FilterQuery, ObjectID } from 'mongodb';
|
||||
import {
|
||||
ContestNotAttendedError, ContestNotFoundError, HackRejudgeFailedError, PermissionError,
|
||||
ContestNotAttendedError, ContestNotFoundError, HackRejudgeFailedError,
|
||||
PermissionError, ProblemConfigError,
|
||||
ProblemNotFoundError, RecordNotFoundError, UserNotFoundError,
|
||||
} from '../error';
|
||||
import { RecordDoc, Tdoc } from '../interface';
|
||||
@@ -191,6 +192,8 @@ class RecordDetailHandler extends ContestDetailBaseHandler {
|
||||
|
||||
@param('rid', Types.ObjectID)
|
||||
async postRejudge(domainId: string, rid: ObjectID) {
|
||||
const pdoc = await problem.get(domainId, this.rdoc.pid);
|
||||
if (!pdoc?.config || typeof pdoc.config === 'string') throw new ProblemConfigError();
|
||||
const priority = await record.submissionPriority(this.user._id, -20);
|
||||
const isContest = this.rdoc.contest && this.rdoc.contest.toString() !== '000000000000000000000000';
|
||||
await record.reset(domainId, rid, true);
|
||||
|
||||
Reference in new issue
Block a user