-
Improvement
-
Resolution: Done
-
Minor
-
None
-
5.0
-
None
-
MOODLE_500_STABLE
-
The main "issue" across MDL-84247 MDL-84246, is that when a qtype is removed/uninstalled, the system just doesn't play nice in various ways, and throws errors, which it shouldn't.
For example, any of these scenarios where a question exists with an invalid type:
- Clicking the "usage" number, throws a fatal error
- Attempting a quiz, throws a fatal error
- Attempting to move the question, throws a fatal error
- And I'm sure there are more I haven't spotted yet
The initial suggestion on this ticket was to delete those questions with an invalid type, but I don't think we want to do that, as they should be recoverable if the question type is installed again. So, it seems that the best solution to all these issues would be to simply filter out invalid question types when loading questions, that way everything will continue to work as normal as if the questions were removed, but if the type is ever re-installed, they will work again.
This ticket aims to make improvements in various areas to how missing question types are handled, which should fix both of the related tickets.
Invalid questions should:
Question Bank
- Still be displayed, but be clearer that they are invalid
- Be able to be deleted
- Have the "move" action removed as it won't work
- Have the "comments" popup removed as it won't work
- Have the "usage" popup removed as it won't work (We cannot easily make it work as it expects to display the question, but possibly in a future improvement we could alter this?)
Quiz
- Still be displayed in the list of questions, but be clearer they are invalid
- Not be allowed to be added to a quiz (manually or via random questions)
- Have better error handling when attempting the quiz than a thrown exception, or possibly remove the option to preview/take the quiz
transfer_question_categories adhoc task
- Be ignored by the task if they are invalid
Other areas
- To be investigated
Things to be considered
- The conversion task is adhoc which is called on install of mod_qbank and never again, so in the case of then wanting to convert previously invalid questions which have been fixed by the type being added back, we need a way to call that again