From afca610c099bce64cd651c2edbedde7c08347f92 Mon Sep 17 00:00:00 2001 From: Cristiano Ferreira Date: Mon, 15 Jul 2024 18:21:06 +0100 Subject: [PATCH] Fix level test generation. --- helper/exercises.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/helper/exercises.py b/helper/exercises.py index 8c12869..85d187c 100644 --- a/helper/exercises.py +++ b/helper/exercises.py @@ -1085,11 +1085,12 @@ def replace_exercise_if_exists(all_exams, current_exercise, current_exam, seen_k for exam in all_exams: exam_dict = exam.to_dict() + exercise_dict = exam_dict.get("parts", [])[0] if any( exercise["prompt"] == current_exercise["prompt"] and any(exercise["options"][0]["text"] == current_option["text"] for current_option in current_exercise["options"]) - for exercise in exam_dict.get("exercises", [])[0]["questions"] + for exercise in exercise_dict.get("exercises", [])[0]["questions"] ): return replace_exercise_if_exists(all_exams, generate_single_mc_level_question(), current_exam, seen_keys) return current_exercise, seen_keys