Resolution: Won't Do
Consider the following hierarchy of courses and course categories.
Now consider the following sequences of actions:
1. Create question QA1 in the question bank for course A101 and add it to a quiz in that course.
Now suppose we want to share that question with A102, therefore.
2. Move QA1 to the question bank for category Cat A.
3. Add QA1 to a quiz in course A102.
So far, so good.
4. A teacher on A102 who does not know that the question is used in course A101 moves the question to the question bank for course A102.
This is currently permitted, and nothing really breaks at this stage, although it is a bad idea because.
5. Admin decides A102 is no longer needed, and deletes it.
This breaks the quiz in A101.
1. Teacher creates question QB1 in the question bank for Cat B1 with the thought that they might be shared in future.
2. Teacher adds QB1 to a quiz in Course B101
3. Admin does a clean up and moves Course B101 to Cat B2 for some reason.
This is also bad, because once again we have a quiz in a course accessing a question it should not really have access to, although again, nothing breaks at this stage. And indeed, even if
4. Admin now deletes Cat B1 because it is now empty.
nothing goes wrong, once my fix to
MDL-14633 is in place.
Anyway, the summary is, it is possible to get Moodle into a state where a quiz is using a question that, it it was removed, there would be no (easy) way to add back. I think this is bad, and we should try to prevent it happening.
When it is a case of moving questions in the question bank, it is reasonable to enforce the sharing rules and prevent people moving questions from a more general place to a more specific place, if that would cause the rules to be broken.
When it is a case of moving a course (or course category), I am not sure how appropriate it is to try to prevent that from the question bank. Ho Hum.
- has been marked as being related by
MDL-20570 Shared questions not backed up, leading to DB data corruption and SQL errors
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
- will help resolve
MDL-54724 Investigate and fix invalid question_multianswer sequence