Set default question options when there are none in the DB during restore #41
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We have a quiz backup containing mtf questions in a random question using the plugin in version 2025031900.
During the restore on a 5.2dev Moodle with your latest version from master, I get an error by using a property on false.
is the code in question where
$question->optionsis false. This is because the query$DB->get_record('qtype_mtf_options', array('questionid' => $question->id));returns no results.Besides that, the question options that are possibly fetched in
parent::get_question_options($question);two lines above would be overwritten there.I changed the code by
I also made two little corrections, using a define and dropping the unused index variable in a loop.