core: fix bugs

This commit is contained in:
panda committed 2022-06-28 16:54:28 +08:00
1 parent d7f72617c8
commit 4529a501da
1 file changed
+3 -2
+3 -2
View File
@@ -727,7 +727,7 @@ const scripts: UpgradeScript[] = [
for (const pdoc of pdocs) {
try {
const config = yaml.load(pdoc.config as string) as any;
if (config.type !== 'objective') continue;
if (config.type !== 'objective' || !config.outputs) continue;
config.answers = {};
let cnt = 0;
for (const l of config.outputs) {
@@ -756,7 +756,7 @@ const scripts: UpgradeScript[] = [
} else text += `{{ input(${scnt}) }}\n`;
text += '\n';
}
} catch (e) { console.error(e); }
} catch (e) { console.error(e); return content; }
return text;
}
@@ -772,6 +772,7 @@ const scripts: UpgradeScript[] = [
}
} catch (e) {
const content = processSingleLanguage(pdoc.content);
delete config.outputs;
await problem.edit(ddoc._id, pdoc.docId, { content });
}
uids.add(pdoc.owner);