$actions[$quid]->timestamp = $time;
}
}
+ ksort($actions[$quid]->responses);
return $actions;
}
// Check for unchanged responses (exactly unchanged, not equivalent).
// We also have to catch questions that the student has not yet attempted
$sameresponses = !$state->last_graded->event == QUESTION_EVENTOPEN &&
- $state->responses == $action->responses;
+ $QTYPES[$question->qtype]->compare_responses($question, $action, $state);
// If the response has not been changed then we do not have to process it again
// unless the attempt is closing or validation is requested
// arrays. The ordering of the arrays does not matter.
// Question types may wish to override this (eg. to ignore trailing
// white space or to make "7.0" and "7" compare equal).
- return $state->responses == $teststate->responses;
+ return $state->responses === $teststate->responses;
}
/**
function compare_responses($question, $state, $teststate) {
if (isset($state->responses['']) && isset($teststate->responses[''])) {
if ($question->options->usecase) {
- return $state->responses[''] == $teststate->responses[''];
+ return strcmp($state->responses[''], $teststate->responses['']) == 0;
} else {
return strcasecmp($state->responses[''], $teststate->responses['']) == 0;
}