|
|
|
@ -51,8 +51,11 @@ class ProblemImportHydroHandler extends Handler {
|
|
|
|
|
if (!files.includes('problem.yaml')) continue;
|
|
|
|
|
const content = fs.readFileSync(path.join(tmpdir, i, 'problem.yaml'), 'utf-8');
|
|
|
|
|
const pdoc: ProblemDoc = yaml.load(content) as any;
|
|
|
|
|
const current = await problem.get(domainId, pdoc.pid);
|
|
|
|
|
const pid = current ? undefined : pdoc.pid;
|
|
|
|
|
let pid = pdoc?.pid;
|
|
|
|
|
if (pid) {
|
|
|
|
|
const current = await problem.get(domainId, pid);
|
|
|
|
|
if (current) pid = undefined;
|
|
|
|
|
}
|
|
|
|
|
const overrideContent = findOverrideContent(path.join(tmpdir, i));
|
|
|
|
|
const docId = await problem.add(
|
|
|
|
|
domainId, pid, pdoc.title, overrideContent || pdoc.content,
|
|
|
|
|