Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 2.1.1, 2.2
-
Fix Version/s: 2.1.2
-
Component/s: Questions
-
Labels:
-
Testing Instructions:
-
Affected Branches:MOODLE_21_STABLE, MOODLE_22_STABLE
-
Fixed Branches:MOODLE_21_STABLE
-
Pull from Repository:
-
Pull Master Branch:
-
Pull Master Diff URL:
Description
Sorry, I need to file another question-related problem. Not sure whether this is only related to data migration.
When a quiz attempt contains a deleted question, viewing the quiz attempt (mod/quiz/review.php) fails with an error message as below. The remainder of the page is not shown.
Category ID is invalid
More information about this error
Stack trace:
- line 429 of /lib/setuplib.php: moodle_exception thrown
- line 1349 of /lib/questionlib.php: call to print_error()
- line 696 of /mod/quiz/attemptlib.php: call to question_has_capability_on()
- line 951 of /mod/quiz/attemptlib.php: call to quiz_attempt->get_display_options_with_edit_link()
- line 182 of /mod/quiz/renderer.php: call to quiz_attempt->render_question()
- line 54 of /mod/quiz/renderer.php: call to mod_quiz_renderer->questions()
- line 259 of /mod/quiz/review.php: call to mod_quiz_renderer->review_page()
This comes about as follows. In qtype_missingtype::make_deleted_instance(), the category id of the "fake" question is set to NULL. However, in lib/questionlib.php, function question_has_capability_on(), the question is tested on having a valid category. None is found, so an error is encountered.
So far, I was able to reproduce this with migrated data only. Is Moodle 2.1 expected to deal with "deleted questions" or is this a problem of the migration process?