From f48f8fe5f74fa51a5d444f20e62471cb9aa045d0 Mon Sep 17 00:00:00 2001 From: undefined Date: Wed, 22 May 2024 17:42:58 +0800 Subject: [PATCH] core: hack: do not rejudge all in contest when hack success --- packages/hydrooj/src/handler/judge.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/hydrooj/src/handler/judge.ts b/packages/hydrooj/src/handler/judge.ts index fd8da0c91..c7c32b7ae 100644 --- a/packages/hydrooj/src/handler/judge.ts +++ b/packages/hydrooj/src/handler/judge.ts @@ -5,6 +5,7 @@ import { omit } from 'lodash'; import { ObjectId } from 'mongodb'; import PQueue from 'p-queue'; import sanitize from 'sanitize-filename'; +import { Context } from '../context'; import { FileLimitExceededError, ForbiddenError, ProblemIsReferencedError, ValidationError, } from '../error'; @@ -109,6 +110,7 @@ export async function postJudge(rdoc: RecordDoc) { bus.on('record/judge', async (rdoc, updated, pdoc) => { if (!pdoc || rdoc.status !== STATUS.STATUS_HACK_SUCCESSFUL) return; + if (rdoc.contest) return; try { const config = yaml.load(pdoc.config as string) as ProblemConfigFile; 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_upload', '/judge/upload', JudgeFileUpdateHandler, builtin.PRIV.PRIV_JUDGE); ctx.Connection('judge_conn', '/judge/conn', JudgeConnectionHandler, builtin.PRIV.PRIV_JUDGE);