We have run into a problem a few times recently where students and teachers go to review quiz attempts and get a fatal error. It seems that questions or question categories that were in use got deleted.
While we haven't been able to determine exactly what happened, we have been able to reprodice the outward behaviour:
- Create Quiz A with questions in the course category
- Create Quiz B with the same questions
- In Quiz A, go into the question bank and move the questions to "Default of Quiz A"
- As a student, attempt Quiz B.
- You should be able to review your attempt without issue
- As a teacher, delete Quiz A
- Now attempt to review the quiz attempt in Quiz B as a student or teacher, you will see "Can not find data record in database table context" fatal error
MDL-47787 After deleting a quiz, its question categories and questions remain in database