mod-lesson MDL-22349 Fixed bug with matching lesson type and empty correct response. Kudos to Michael Lipp for the patch

This commit is contained in:
Sam Hemelryk
2010-12-20 18:59:39 +01:00
committed by Petr Skoda
parent 635f4f2c64
commit 2e490b8b29
+3 -16
View File
@@ -415,12 +415,7 @@
$response = '';
if ($ncorrect == count($answers)-2) { // dont count correct/wrong responses in the total.
foreach ($answers as $answer) {
if ($answer->response == NULL && $answer->answer != NULL) {
$response = $answer->answer;
break;
}
}
$response = reset($answers)->answer;
if (isset($correctpageid)) {
$newpageid = $correctpageid;
}
@@ -429,16 +424,8 @@
}
$correctanswer = true;
} else {
$t = 0;
foreach ($answers as $answer) {
if ($answer->response == NULL && $answer->answer != NULL) {
if ($t == 1) {
$response = $answer->answer;
break;
}
$t++;
}
}
reset($answers);
$response = next($answers)->answer;
$newpageid = $wrongpageid;
$answerid = $wronganswerid;
}