Permalink
Browse files

MDL-33030 Lesson module: fixed progress bar

  • Loading branch information...
Rossiani Wijaya
Rossiani Wijaya committed Jul 2, 2012
1 parent 116714e commit 06f52d36cc20725099de6ba8b8b8914413c32b89
Showing with 10 additions and 5 deletions.
  1. +10 −5 mod/lesson/renderer.php
View
@@ -510,15 +510,20 @@ public function progress_bar(lesson $lesson) {
$ntries = 0; // may not be necessary
}
-
$viewedpageids = array();
- if ($attempts = $lesson->get_attempts($ntries, true)) {
- $viewedpageids = array_merge($viewedpageids, array_keys($attempts));
+ if ($attempts = $lesson->get_attempts($ntries, false)) {
+ foreach($attempts as $attempt) {
+ $viewedpageids[$attempt->pageid] = $attempt;
+ }
}
+ $viewedbranches = array();
// collect all of the branch tables viewed
- if ($viewedbranches = $DB->get_records("lesson_branch", array ("lessonid"=>$lesson->id, "userid"=>$USER->id, "retry"=>$ntries), 'timeseen DESC', 'id, pageid')) {
- $viewedpageids = array_merge($viewedpageids, array_keys($viewedbranches));
+ if ($branches = $DB->get_records("lesson_branch", array ("lessonid"=>$lesson->id, "userid"=>$USER->id, "retry"=>$ntries), 'timeseen ASC', 'id, pageid')) {
+ foreach($branches as $branch) {
+ $viewedbranches[$branch->pageid] = $branch;
+ }
+ $viewedpageids = array_merge($viewedpageids, $viewedbranches);
}
// Filter out the following pages:

0 comments on commit 06f52d3

Please sign in to comment.