Skip to content

Commit

Permalink
MDL-83127 qtype_ordering: handle NULL in question_hints table entries.
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaboesch committed Sep 13, 2024
1 parent f86b97f commit 37f5141
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions question/type/ordering/classes/question_hint_ordering.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,16 @@ public static function load_from_record($row): question_hint_ordering {
global $DB;

// Initialize with the old questions.
if (is_null($row->options) || is_null($row->shownumcorrect)) {
$row->options = 1;
$row->shownumcorrect = 1;
if (is_null($row->options) || is_null($row->shownumcorrect) || is_null($row->clearwrong)) {
if (is_null($row->options)) {
$row->options = 1;
}
if (is_null($row->shownumcorrect)) {
$row->shownumcorrect = 1;
}
if (is_null($row->clearwrong)) {
$row->clearwrong = 1;
}
$DB->update_record('question_hints', $row);
}

Expand Down

0 comments on commit 37f5141

Please sign in to comment.