mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 17:46:28 +08:00
import-qduoj: fix #256
This commit is contained in:
1 parent
52cdd166aa
commit
50b838d21d
1 file changed
+21
-11
@@ -82,29 +82,39 @@ class ImportQduojHandler extends Handler {
|
|||||||
memory: `${pdoc.memory_limit}m`,
|
memory: `${pdoc.memory_limit}m`,
|
||||||
subtasks: [],
|
subtasks: [],
|
||||||
};
|
};
|
||||||
|
const tasks = [];
|
||||||
for (const tc of pdoc.test_case_score) {
|
for (const tc of pdoc.test_case_score) {
|
||||||
await Promise.all([
|
tasks.push(ProblemModel.addTestdata(
|
||||||
ProblemModel.addTestdata(
|
domainId, pid, tc.input_name,
|
||||||
domainId, pid, tc.input_name,
|
path.join(tmp, folder, 'testcase', tc.input_name),
|
||||||
path.join(tmp, folder, 'testcase', tc.input_name),
|
));
|
||||||
),
|
if (tc.output_name !== '-') {
|
||||||
ProblemModel.addTestdata(
|
tasks.push(ProblemModel.addTestdata(
|
||||||
domainId, pid, tc.output_name,
|
domainId, pid, tc.output_name,
|
||||||
path.join(tmp, folder, 'testcase', tc.output_name),
|
path.join(tmp, folder, 'testcase', tc.output_name),
|
||||||
),
|
));
|
||||||
]);
|
}
|
||||||
config.subtasks.push({
|
config.subtasks.push({
|
||||||
score: tc.score,
|
score: tc.score,
|
||||||
cases: [{
|
cases: [{
|
||||||
input: tc.input_name,
|
input: tc.input_name,
|
||||||
output: tc.output_name,
|
output: tc.output_name === '-' ? '/dev/null' : tc.output_name,
|
||||||
}],
|
}],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
await Promise.all([
|
if (pdoc.spj?.language === 'C++') {
|
||||||
|
tasks.push(ProblemModel.addTestdata(
|
||||||
|
domainId, pid, 'checker.cc',
|
||||||
|
Buffer.from(pdoc.spj.code),
|
||||||
|
));
|
||||||
|
config.checker = 'checker.cc';
|
||||||
|
config.checker_type = 'qduoj';
|
||||||
|
}
|
||||||
|
tasks.push(
|
||||||
ProblemModel.addTestdata(domainId, pid, 'config.yaml', Buffer.from(yaml.dump(config))),
|
ProblemModel.addTestdata(domainId, pid, 'config.yaml', Buffer.from(yaml.dump(config))),
|
||||||
ProblemModel.edit(domainId, pid, { html: true }),
|
ProblemModel.edit(domainId, pid, { html: true }),
|
||||||
]);
|
);
|
||||||
|
await Promise.all(tasks);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
await fs.remove(tmp);
|
await fs.remove(tmp);
|
||||||
|
|||||||
Reference in new issue
Block a user