diff --git a/src/tree.py b/src/tree.py index 1a43375c226a1bca494459af9c4e174ea43862e3..692eff50aef8ea6a8dc683401930b5369f5ffef3 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"])