-
Bug
-
Resolution: Fixed
-
Major
-
2.6.5, 2.7.2
-
MOODLE_26_STABLE, MOODLE_27_STABLE
-
MOODLE_28_STABLE, MOODLE_29_STABLE
-
MDL-47787-master -
When a quiz is created, a new question category for that quiz is automatically created. After that quiz is deleted, it's question category and questions in that category remain in database. Problem is that it is not possible to reach those orphaned questions and potentially to move them to some other category.
Steps to reproduce the bug:
- Create a new course
- Add a quiz to the course, and name it NewQuiz
- Go to Editing quiz page
- In Question bank content block choose 'Default to NewQuiz' category
- Create a new question (e.g. a Short answer question) in 'Default to NewQuiz'
- Navigate to Site administration -> Plugins -> Question types -> Manage question types, and note the number of Short answer questions
- Navigate to Site administration -> Reports -> Question instances, choose the Short answer question type, and there should be one question in 'Quiz: NewQuiz' context.
- Now, delete the NewQuiz quiz from the course
- Navigate to Site administration -> Plugins -> Question types -> Manage question types. Number of Short answer questions has not changed
- Navigate to Site administration -> Reports -> Question instances, choose the Short answer question type. The 'Quiz: NewQuiz' context is not listed anymore.
After deleting a quiz, it's context is deleted, but question category remains and points to nonexistent context. If you perform following query in database, you should be able to see 'Deault to NewQuiz' category:
SELECT qc.id, qc.name, qc.contextid, qc.parent, ctx.*
|
FROM mdl_question_categories qc
|
LEFT OUTER JOIN mdl_context ctx ON ctx.id = qc.contextid
|
WHERE ctx.id IS NULL;
|
I would expect to either be able to access questions from deleted quiz, or that those category and questions are deleted together with quiz.
- has been marked as being related by
-
MDL-68457 Fix orphaned questions script no longer works
- Open
- is duplicated by
-
MDL-51071 Possible to delete questions that are in use
- Closed
-
MDL-14803 Rewrite question_delete_course and question_delete_activity to use the logic from question_delete_course_category that calls question_save_from_deletion
- Closed
- will help resolve
-
CONTRIB-5261 Flashcard error when question categories exist in bad context
- Open
-
MDL-29905 Deleting a quiz category with no questions behaves like it does have questions.
- Closed
-
MDL-14803 Rewrite question_delete_course and question_delete_activity to use the logic from question_delete_course_category that calls question_save_from_deletion
- Closed