Fix array index out of bounds.
This commit is contained in:
@@ -1260,13 +1260,14 @@ def replace_exercise_if_exists(all_exams, current_exercise, current_exam, seen_k
|
|||||||
for exam in all_exams:
|
for exam in all_exams:
|
||||||
exam_dict = exam.to_dict()
|
exam_dict = exam.to_dict()
|
||||||
exercise_dict = exam_dict.get("parts", [])[0]
|
exercise_dict = exam_dict.get("parts", [])[0]
|
||||||
if any(
|
if len(exercise_dict.get("exercises", [])) > 0:
|
||||||
exercise["prompt"] == current_exercise["prompt"] and
|
if any(
|
||||||
any(exercise["options"][0]["text"] == current_option["text"] for current_option in
|
exercise["prompt"] == current_exercise["prompt"] and
|
||||||
current_exercise["options"])
|
any(exercise["options"][0]["text"] == current_option["text"] for current_option in
|
||||||
for exercise in exercise_dict.get("exercises", [])[0]["questions"]
|
current_exercise["options"])
|
||||||
):
|
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 replace_exercise_if_exists(all_exams, generate_single_mc_level_question(), current_exam, seen_keys)
|
||||||
return current_exercise, seen_keys
|
return current_exercise, seen_keys
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user