Permalink
Browse files

mod-lesson MDL-22349 Fixed bug with matching lesson type and empty co…

…rrect response. Kudos to Michael Lipp for the patch
  • Loading branch information...
1 parent 635f4f2 commit 2e490b8b29d8cec3bd0ab5d1ac7e9a7cb6aa8e56 Sam Hemelryk committed with skodak Dec 13, 2010
Showing with 3 additions and 16 deletions.
  1. +3 −16 mod/lesson/action/continue.php
@@ -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;
}

0 comments on commit 2e490b8

Please sign in to comment.