-
Bug
-
Resolution: Fixed
-
Minor
-
2.4.3, 2.5
-
MOODLE_24_STABLE, MOODLE_25_STABLE
-
MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE
-
MDL-39536-master -
While debugging MDL-37773, I came across report_progress_extend_navigation_course() which is highly inefficient when it comes to adding nodes to the navigation.
If activity completion is enabled on the course, then it gets all the activities just to ensure that at least one has completion enabled. This is a massive processing where a simple DB->record_exists would be just enough.
$showonnavigation = ($showonnavigation && $completion->is_enabled() && ($completion->get_activities())>0);
|
Will call:
public function get_activities($modinfo=null) {
|
global $DB;
|
|
// Obtain those activities which have completion turned on
|
$withcompletion = $DB->get_records_select('course_modules', 'course='.$this->course->id.
|
' AND completion<>'.COMPLETION_TRACKING_NONE);
|
if (!$withcompletion) {
|
return array();
|
}
|
|
// Use modinfo to get section order and also add in names
|
if (empty($modinfo)) {
|
$modinfo = get_fast_modinfo($this->course);
|
}
|
$result = array();
|
foreach ($modinfo->sections as $sectioncms) {
|
foreach ($sectioncms as $cmid) {
|
if (array_key_exists($cmid, $withcompletion)) {
|
$result[$cmid] = $withcompletion[$cmid];
|
$result[$cmid]->modname = $modinfo->cms[$cmid]->modname;
|
$result[$cmid]->name = $modinfo->cms[$cmid]->name;
|
}
|
}
|
}
|
|
return $result;
|
}
|
loading modinfo for each module.
- Testing discovered
-
MDL-37773 Requested user profile field does not exist
-
- Closed
-