Fix array index out of bounds.

This commit is contained in:
Cristiano Ferreira
2024-07-22 14:54:01 +01:00
parent d5621c1793
commit 1ecda04c6b

View File

@@ -1260,6 +1260,7 @@ 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 len(exercise_dict.get("exercises", [])) > 0:
if any(
exercise["prompt"] == current_exercise["prompt"] and
any(exercise["options"][0]["text"] == current_option["text"] for current_option in