Permalink
Browse files

Merge branch 'MDL-31775_m21' of git://github.com/rwijaya/moodle into …

…MOODLE_21_STABLE
  • Loading branch information...
2 parents 8b2aff4 + 5577a1a commit 38dbeec003a77f7481efba9e8eff34811dc664fb @danpoltawski danpoltawski committed Mar 26, 2012
Showing with 11 additions and 13 deletions.
  1. +11 −13 mod/lesson/view.php
View
@@ -194,20 +194,18 @@
// if there are any questions have been answered correctly in this attempt
$corrrectattempts = $lesson->get_attempts($retries, true);
if ($corrrectattempts>0) {
- foreach ($corrrectattempts as $attempt) {
- $jumpto = $DB->get_field('lesson_answers', 'jumpto', array('id' => $attempt->answerid));
- // convert the jumpto to a proper page id
- if ($jumpto == 0) { // unlikely value!
- $lastpageseen = $attempt->pageid;
- } elseif ($jumpto == LESSON_NEXTPAGE) {
- if (!$lastpageseen = $DB->get_field('lesson_pages', 'nextpageid', array('id' => $attempt->pageid))) {
- // no nextpage go to end of lesson
- $lastpageseen = LESSON_EOL;
- }
- } else {
- $lastpageseen = $jumpto;
+ $attempt = end($corrrectattempts);
+ $jumpto = $DB->get_field('lesson_answers', 'jumpto', array('id' => $attempt->answerid));
+ // convert the jumpto to a proper page id
+ if ($jumpto == 0) { // unlikely value!
+ $lastpageseen = $attempt->pageid;
+ } elseif ($jumpto == LESSON_NEXTPAGE) {
+ if (!$lastpageseen = $DB->get_field('lesson_pages', 'nextpageid', array('id' => $attempt->pageid))) {
+ // no nextpage go to end of lesson
+ $lastpageseen = LESSON_EOL;
}
- break; // only look at the latest correct attempt
+ } else {
+ $lastpageseen = $jumpto;
}
}

0 comments on commit 38dbeec

Please sign in to comment.