From bdc0b21e88ce7a9dece401e994465466597afa0e Mon Sep 17 00:00:00 2001 From: panda Date: Mon, 5 Sep 2022 17:39:05 +0800 Subject: [PATCH] core: fix hack data add to testdata --- packages/hydrooj/src/handler/judge.ts | 2 +- packages/hydrooj/src/handler/problem.ts | 1 + packages/ui-default/templates/problem_hack.html | 2 +- packages/ui-default/templates/record_detail.html | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/hydrooj/src/handler/judge.ts b/packages/hydrooj/src/handler/judge.ts index c8422e10e..472b70583 100644 --- a/packages/hydrooj/src/handler/judge.ts +++ b/packages/hydrooj/src/handler/judge.ts @@ -85,7 +85,7 @@ export async function postJudge(rdoc: RecordDoc) { try { const config = yaml.load(pdoc.config as string) as ProblemConfigFile; assert(config.subtasks instanceof Array); - const file = await storage.get(`submission/${rdoc.files.hack}`); + const file = await storage.get(`submission/${rdoc.files.hack.split('#')[0]}`); assert(file); const hackSubtask = config.subtasks[config.subtasks.length - 1]; hackSubtask.cases ||= []; diff --git a/packages/hydrooj/src/handler/problem.ts b/packages/hydrooj/src/handler/problem.ts index cf67d6516..5dc6882ff 100644 --- a/packages/hydrooj/src/handler/problem.ts +++ b/packages/hydrooj/src/handler/problem.ts @@ -564,6 +564,7 @@ export class ProblemHackHandler extends ProblemDetailHandler { this.response.body = { pdoc: this.pdoc, udoc: this.udoc, + rid: this.rdoc._id, title: this.pdoc.title, page_name: this.tdoc ? 'contest_detail_problem_hack' : 'problem_hack', }; diff --git a/packages/ui-default/templates/problem_hack.html b/packages/ui-default/templates/problem_hack.html index 597007f1d..6f76d1d28 100644 --- a/packages/ui-default/templates/problem_hack.html +++ b/packages/ui-default/templates/problem_hack.html @@ -5,7 +5,7 @@
-

{{ _('Hack a submission') }}

+

{{ _('Hack submission') }} #{{ rid }}

diff --git a/packages/ui-default/templates/record_detail.html b/packages/ui-default/templates/record_detail.html index 0038a5e0e..a6cbab979 100644 --- a/packages/ui-default/templates/record_detail.html +++ b/packages/ui-default/templates/record_detail.html @@ -53,7 +53,7 @@