mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
judge: fix subtask id handler
This commit is contained in:
1 parent
e027b74f2d
commit
87c8eb060c
2 files changed
+10
-6
No files matched your search
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@hydrooj/hydrojudge",
|
||||
"bin": "bin/hydrojudge.js",
|
||||
"version": "3.1.2",
|
||||
"version": "3.1.3",
|
||||
"main": "package.json",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||
|
||||
@@ -100,15 +100,19 @@ export const runFlow = async (ctx: Context, task: Task) => {
|
||||
ctx.end({ nop: true });
|
||||
}
|
||||
} else {
|
||||
const tasks = [];
|
||||
for (const sid in ctx.config.subtasks) tasks.push(judgeSubtask(ctx.config.subtasks[sid], sid, task.judgeCase)(ctx));
|
||||
const scores = await Promise.all(tasks);
|
||||
for (const sid in ctx.config.subtasks) {
|
||||
const scores = {};
|
||||
await Promise.all(Object.entries(ctx.config.subtasks).map(async ([key, value]) => {
|
||||
const sid = value.id?.toString() || key;
|
||||
scores[sid] = await judgeSubtask(value, sid, task.judgeCase)(ctx);
|
||||
}));
|
||||
for (const [key, value] of Object.entries(ctx.config.subtasks)) {
|
||||
let effective = true;
|
||||
for (const required of ctx.config.subtasks[sid].if || []) {
|
||||
const sid = value.id?.toString() || key;
|
||||
for (const required of value.if || []) {
|
||||
if (ctx.failed[required.toString()]) effective = false;
|
||||
}
|
||||
if (effective) ctx.total_score += scores[sid];
|
||||
else ctx.failed[sid] = true;
|
||||
}
|
||||
ctx.end({
|
||||
status: ctx.total_status,
|
||||
|
||||
Reference in new issue
Block a user