mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
core: disallow to rejudge pretest record (#796)
This commit is contained in:
1 parent
5186e35712
commit
89448d5678
2 files changed
+5
-4
No files matched your search
@@ -114,6 +114,7 @@ export const ProblemAlreadyUsedByContestError = Err('ProblemAlreadyUsedByContest
|
||||
export const ProblemNotAllowPretestError = Err('ProblemNotAllowPretestError', ForbiddenError, 'Pretesting is not supported for {0}.');
|
||||
export const ProblemNotAllowLanguageError = Err('ProblemNotAllowSubmitError', ForbiddenError, 'This language is not allowed to submit.');
|
||||
|
||||
export const PretestRejudgeFailedError = Err('PretestRejudgeFailedError', BadRequestError, 'Cannot rejudge a pretest record.');
|
||||
export const HackRejudgeFailedError = Err('HackRejudgeFailedError', BadRequestError, 'Cannot rejudge a hack record.');
|
||||
export const CannotDeleteSystemDomainError = Err('CannotDeleteSystemDomainError', BadRequestError, 'You are not allowed to delete system domain.');
|
||||
export const OnlyOwnerCanDeleteDomainError = Err('OnlyOwnerCanDeleteDomainError', BadRequestError, 'You are not the owner of this domain.');
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
import { Filter, ObjectId } from 'mongodb';
|
||||
import {
|
||||
ContestNotFoundError, HackRejudgeFailedError,
|
||||
PermissionError, ProblemConfigError,
|
||||
PermissionError, PretestRejudgeFailedError, ProblemConfigError,
|
||||
ProblemNotFoundError, RecordNotFoundError, UserNotFoundError,
|
||||
} from '../error';
|
||||
import { RecordDoc, Tdoc } from '../interface';
|
||||
@@ -177,7 +177,7 @@ class RecordDetailHandler extends ContestDetailBaseHandler {
|
||||
|
||||
// eslint-disable-next-line prefer-const
|
||||
let [pdoc, self, udoc] = await Promise.all([
|
||||
problem.get(rdoc.domainId, rdoc.pid),
|
||||
problem.get(rdoc.domainId, rdoc.pid, problem.PROJECTION_LIST),
|
||||
problem.getStatus(domainId, rdoc.pid, this.user._id),
|
||||
user.getById(domainId, rdoc.uid),
|
||||
]);
|
||||
@@ -209,6 +209,7 @@ class RecordDetailHandler extends ContestDetailBaseHandler {
|
||||
async post() {
|
||||
this.checkPerm(PERM.PERM_REJUDGE);
|
||||
if (this.rdoc.files?.hack) throw new HackRejudgeFailedError();
|
||||
if (this.rdoc.contest?.toString().startsWith('0'.repeat(23))) throw new PretestRejudgeFailedError();
|
||||
}
|
||||
|
||||
@param('rid', Types.ObjectId)
|
||||
@@ -216,10 +217,9 @@ class RecordDetailHandler extends ContestDetailBaseHandler {
|
||||
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';
|
||||
const rdoc = await record.reset(domainId, rid, true);
|
||||
this.ctx.broadcast('record/change', rdoc);
|
||||
await record.judge(domainId, rid, priority, isContest ? { detail: false } : {});
|
||||
await record.judge(domainId, rid, priority, this.rdoc.contest ? { detail: false } : {});
|
||||
this.back();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user