From b88266ff123a5ec727a2887a7dca2a377aa9eb0f Mon Sep 17 00:00:00 2001 From: Mars Liu Date: Tue, 30 Nov 2021 19:44:00 +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