mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +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`,
|
||||
subtasks: [],
|
||||
};
|
||||
const tasks = [];
|
||||
for (const tc of pdoc.test_case_score) {
|
||||
await Promise.all([
|
||||
ProblemModel.addTestdata(
|
||||
domainId, pid, tc.input_name,
|
||||
path.join(tmp, folder, 'testcase', tc.input_name),
|
||||
),
|
||||
ProblemModel.addTestdata(
|
||||
tasks.push(ProblemModel.addTestdata(
|
||||
domainId, pid, tc.input_name,
|
||||
path.join(tmp, folder, 'testcase', tc.input_name),
|
||||
));
|
||||
if (tc.output_name !== '-') {
|
||||
tasks.push(ProblemModel.addTestdata(
|
||||
domainId, pid, tc.output_name,
|
||||
path.join(tmp, folder, 'testcase', tc.output_name),
|
||||
),
|
||||
]);
|
||||
));
|
||||
}
|
||||
config.subtasks.push({
|
||||
score: tc.score,
|
||||
cases: [{
|
||||
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.edit(domainId, pid, { html: true }),
|
||||
]);
|
||||
);
|
||||
await Promise.all(tasks);
|
||||
}
|
||||
} finally {
|
||||
await fs.remove(tmp);
|
||||
|
||||
Reference in new issue
Block a user