import-qduoj: fix #256

pull/461/head
undefined 2 years ago
parent 52cdd166aa
commit 50b838d21d

@ -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(
tasks.push(ProblemModel.addTestdata(
domainId, pid, tc.input_name,
path.join(tmp, folder, 'testcase', tc.input_name),
),
ProblemModel.addTestdata(
));
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);

Loading…
Cancel
Save