MDL-80127 question engine: don't convert null to '' before storing

This commit is contained in:
Tim Hunt
2023-12-06 11:38:58 +00:00
parent a418e9e53a
commit ff74bb2682
2 changed files with 31 additions and 1 deletions
+2 -1
View File
@@ -149,6 +149,7 @@ class question_engine_data_mapper {
/**
* Helper method used by insert_question_attempt_step and update_question_attempt_step
*
* @param question_attempt_step $step the step to store.
* @param int $questionattemptid the question attept id this step belongs to.
* @param int $seq the sequence number of this stop.
@@ -158,7 +159,7 @@ class question_engine_data_mapper {
$record = new stdClass();
$record->questionattemptid = $questionattemptid;
$record->sequencenumber = $seq;
$record->state = (string) $step->get_state();
$record->state = $step->get_state()?->__toString();
$record->fraction = $step->get_fraction();
$record->timecreated = $step->get_timecreated();
$record->userid = $step->get_user_id();