From f01e3496eb78c880439c479861f27945e05cead9 Mon Sep 17 00:00:00 2001 From: Mars Liu Date: Tue, 30 Nov 2021 19:43:51 +0800 Subject: [PATCH] fixed odd orders --- src/tree.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/tree.py b/src/tree.py index 1a43375..692eff5 100644 --- a/src/tree.py +++ b/src/tree.py @@ -303,6 +303,9 @@ class TreeWalker: for e in config.get("export", []): full_name = os.path.join(section_path, e) exercise = load_json(full_name) - if "exercise_id" not in exercise: - exercise["exercise_id"] = uuid.uuid4().hex + if "exercise_id" not in exercise or exercise.get("exercise_id") in id_set: + eid = uuid.uuid4().hex + exercise["exercise_id"] = eid dump_json(full_name, exercise, True, True) + else: + id_set.add(exercise["exercise_id"]) -- GitLab