Skip to content

Commit

Permalink
MDL-33030 Lesson module: fixed progress bar
Browse files Browse the repository at this point in the history
  • Loading branch information
Rossiani Wijaya committed Jul 2, 2012
1 parent 116714e commit 06f52d3
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions mod/lesson/renderer.php
Expand Up @@ -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:
Expand Down

0 comments on commit 06f52d3

Please sign in to comment.