提交 6bf6f6ae 编写于 作者: M Mars Liu

fixed odd orders

上级 45a4cfec
......@@ -107,17 +107,6 @@ class TreeWalker:
full_path = os.path.join(chapter_path, f"{index + 1}.{section_title}")
if os.path.isdir(full_path):
self.ensure_exercises(full_path)
# TODO 四级知识点的处理仅为 Java 技能树的临时处理而设定,未来java技能树上线前会删掉这部分代码,将四级节点
# 合并到三级节点
for idx, [num, sub_section_title] in self.sort_dir_list([p for p in os.listdir(full_path)
if os.path.isdir(os.path.join(full_path, p))]):
order = idx + 1
ensure_path = os.path.join(full_path, f"{order}.{sub_section_title}")
forth_full_path = os.path.join(full_path, f"{num}.{sub_section_title}")
if ensure_path != forth_full_path:
os.rename(forth_full_path, ensure_path)
if os.path.isdir(ensure_path):
self.ensure_exercises(forth_full_path)
tree_path = os.path.join(self.root, "tree.json")
dump_json(tree_path, self.tree, exist_ok=True, override=True)
......@@ -310,6 +299,6 @@ class TreeWalker:
full_name = os.path.join(section_path, e)
logger.info(full_name)
exercise = load_json(full_name)
if "exercise_id" not in exercise:
if not exercise.get("exercise_id"):
exercise["exercise_id"] = uuid.uuid4().hex
dump_json(full_name, exercise, exist_ok=True, override=True)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册