qtype_truefalse MDL-22658 questions get marked as answered even when an answer has not been selected.

This commit is contained in:
Tim Hunt
2010-08-04 17:54:55 +00:00
parent a194c2187b
commit 613aff5053
+11
View File
@@ -110,6 +110,17 @@ class question_truefalse_qtype extends default_questiontype {
return true;
}
function compare_responses($question, $state, $teststate) {
if (isset($state->responses['']) && isset($teststate->responses[''])) {
return $state->responses[''] === $teststate->responses[''];
} else if (isset($teststate->responses['']) && $teststate->responses[''] === '' &&
!isset($state->responses[''])) {
// Nothing selected in the past, and nothing selected now.
return true;
}
return false;
}
function get_correct_responses(&$question, &$state) {
// The correct answer is the one which gives full marks
foreach ($question->options->answers as $answer) {