mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: hack: do not rejudge all in contest when hack success
This commit is contained in:
1 file changed
+3
-1
@@ -5,6 +5,7 @@ import { omit } from 'lodash';
|
|||||||
import { ObjectId } from 'mongodb';
|
import { ObjectId } from 'mongodb';
|
||||||
import PQueue from 'p-queue';
|
import PQueue from 'p-queue';
|
||||||
import sanitize from 'sanitize-filename';
|
import sanitize from 'sanitize-filename';
|
||||||
|
import { Context } from '../context';
|
||||||
import {
|
import {
|
||||||
FileLimitExceededError, ForbiddenError, ProblemIsReferencedError, ValidationError,
|
FileLimitExceededError, ForbiddenError, ProblemIsReferencedError, ValidationError,
|
||||||
} from '../error';
|
} from '../error';
|
||||||
@@ -109,6 +110,7 @@ export async function postJudge(rdoc: RecordDoc) {
|
|||||||
|
|
||||||
bus.on('record/judge', async (rdoc, updated, pdoc) => {
|
bus.on('record/judge', async (rdoc, updated, pdoc) => {
|
||||||
if (!pdoc || rdoc.status !== STATUS.STATUS_HACK_SUCCESSFUL) return;
|
if (!pdoc || rdoc.status !== STATUS.STATUS_HACK_SUCCESSFUL) return;
|
||||||
|
if (rdoc.contest) return;
|
||||||
try {
|
try {
|
||||||
const config = yaml.load(pdoc.config as string) as ProblemConfigFile;
|
const config = yaml.load(pdoc.config as string) as ProblemConfigFile;
|
||||||
assert(config.subtasks instanceof Array);
|
assert(config.subtasks instanceof Array);
|
||||||
@@ -323,7 +325,7 @@ export class JudgeConnectionHandler extends ConnectionHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function apply(ctx) {
|
export async function apply(ctx: Context) {
|
||||||
ctx.Route('judge_files_download', '/judge/files', JudgeFilesDownloadHandler, builtin.PRIV.PRIV_JUDGE);
|
ctx.Route('judge_files_download', '/judge/files', JudgeFilesDownloadHandler, builtin.PRIV.PRIV_JUDGE);
|
||||||
ctx.Route('judge_files_upload', '/judge/upload', JudgeFileUpdateHandler, builtin.PRIV.PRIV_JUDGE);
|
ctx.Route('judge_files_upload', '/judge/upload', JudgeFileUpdateHandler, builtin.PRIV.PRIV_JUDGE);
|
||||||
ctx.Connection('judge_conn', '/judge/conn', JudgeConnectionHandler, builtin.PRIV.PRIV_JUDGE);
|
ctx.Connection('judge_conn', '/judge/conn', JudgeConnectionHandler, builtin.PRIV.PRIV_JUDGE);
|
||||||
|
|||||||
Reference in new issue
Block a user