mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: cli: problemexport: auto add default pid
This commit is contained in:
1 file changed
+2
-2
@@ -482,12 +482,12 @@ export class ProblemModel {
|
|||||||
await fs.mkdir(tmpdir);
|
await fs.mkdir(tmpdir);
|
||||||
const pdocs = await ProblemModel.getMulti(domainId, {}, ProblemModel.PROJECTION_PUBLIC).toArray();
|
const pdocs = await ProblemModel.getMulti(domainId, {}, ProblemModel.PROJECTION_PUBLIC).toArray();
|
||||||
for (const pdoc of pdocs) {
|
for (const pdoc of pdocs) {
|
||||||
if (process.env.HYDRO_CLI) logger.info(`Exporting problem ${pdoc.pid} (${pdoc.title})`);
|
if (process.env.HYDRO_CLI) logger.info(`Exporting problem ${pdoc.pid || (`P${pdoc.docId}`)} (${pdoc.title})`);
|
||||||
const problemPath = path.join(tmpdir, `${pdoc.docId}`);
|
const problemPath = path.join(tmpdir, `${pdoc.docId}`);
|
||||||
await fs.mkdir(problemPath);
|
await fs.mkdir(problemPath);
|
||||||
const problemYaml = path.join(problemPath, 'problem.yaml');
|
const problemYaml = path.join(problemPath, 'problem.yaml');
|
||||||
const problemYamlContent = yaml.dump({
|
const problemYamlContent = yaml.dump({
|
||||||
pid: pdoc.pid,
|
pid: pdoc.pid || `P${pdoc.docId}`,
|
||||||
owner: pdoc.owner,
|
owner: pdoc.owner,
|
||||||
title: pdoc.title,
|
title: pdoc.title,
|
||||||
tag: pdoc.tag,
|
tag: pdoc.tag,
|
||||||
|
|||||||
Reference in new issue
Block a user