Commit 6f61e2f4 authored by Myriam Delaruelle's avatar Myriam Delaruelle
Browse files

only display uservisible activities in progress bar

parent d3cd4adb
......@@ -42,18 +42,6 @@ class course_format_iena_completion {
return false;
}
// $modules = $DB->get_records_sql('SELECT cmc.id, cmc.coursemoduleid, cmc.userid, cmc.completionstate, cm.section
// FROM {course_modules_completion} as cmc
// inner join {course_modules} as cm on cm.id = cmc.coursemoduleid
// inner join {user} as u on u.id = cmc.userid
// inner join {modules} as m on m.id = cm.module
// where cm.course = ? and cm.deletioninprogress = 0
// and cmc.userid = ?
// order by section, coursemoduleid asc', array($course->id, $USER->id));
// echo "<pre>";
// var_dump($modules);
// echo "</pre>";
$sections = [];
......@@ -65,7 +53,9 @@ class course_format_iena_completion {
$module = $completion->get_data($cm, true, $USER->id, $fast_modinfo);
$module->url = "$CFG->wwwroot/mod/$cm->modname/view.php?id=$cm->id";
$module->section = $cm->section;
if ( $cm->deletioninprogress == 0 && $cm->completion != 0 ) {
if ( $cm->deletioninprogress == 0 && $cm->completion != 0 && $cm->uservisible) {
$module->name = $cm->name;
$module->url = "$CFG->wwwroot/mod/$cm->modname/view.php?id=$cm->id";
$modules[] = $module;
}
}
......@@ -81,19 +71,15 @@ class course_format_iena_completion {
$inner_modules = [];
$inner_completed = 0;
foreach ($modules as $module) {
if ( $module->section == $section_id ) {
if ( $module->section == $section_id) {
$mod = new StdClass();
$mod->coursemoduleid = $module->coursemoduleid;
$mod->completion = $module->completionstate;
$mod->name = $module->name;
$mod->url = $module->url;
if ( $mod->completion == 1 || $mod->completion == 2 ) {
$inner_completed++;
}
foreach ($modinfos_cms as $cm) {
if ( $cm->id == $mod->coursemoduleid ) {
$mod->name = $cm->name;
$mod->url = "$CFG->wwwroot/mod/$cm->modname/view.php?id=$cm->id";
}
}
$inner_modules[] = $mod;
}
}
......@@ -111,11 +97,6 @@ class course_format_iena_completion {
$progress = new StdClass();
$progress->total = number_format( 100 * $total_completed / $total_modules, 0);
$progress->sections = $sections;
// echo "<pre>";
// var_dump($progress);
// echo "</pre>";
return $progress;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment