core: add default import operator

This commit is contained in:
undefined committed 2023-04-12 18:46:39 +08:00
1 parent 838594530f
commit ba7f4b396f
4 files changed
+10 -6

No files matched your search

+2 -1
View File
@@ -407,7 +407,7 @@ export class ProblemModel {
return true;
}
static async import(domainId: string, filepath: string, operator: number) {
static async import(domainId: string, filepath: string, operator = 1) {
let tmpdir = '';
let del = false;
if (filepath.endsWith('.zip')) {
@@ -482,6 +482,7 @@ export class ProblemModel {
await fs.mkdir(tmpdir);
const pdocs = await ProblemModel.getMulti(domainId, {}, ProblemModel.PROJECTION_PUBLIC).toArray();
for (const pdoc of pdocs) {
if (process.env.HYDRO_CLI) logger.info(`Exporting problem ${pdoc.pid} (${pdoc.title})`);
const problemPath = path.join(tmpdir, `${pdoc.docId}`);
await fs.mkdir(problemPath);
const problemYaml = path.join(problemPath, 'problem.yaml');