Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-31918 Use cached module info for activity completion report

  • Loading branch information...
commit 15958e86778566d3849e3f4967c4f40b19cd5e4b 1 parent cfaa50a
@andrewnicols andrewnicols authored samhemelryk committed
Showing with 5 additions and 8 deletions.
  1. +5 −8 report/completion/index.php
View
13 report/completion/index.php
@@ -91,6 +91,9 @@ function csv_quote($value) {
* Load data
*/
+// Retrieve course_module data for all modules in the course
+$modinfo = get_fast_modinfo($course);
+
// Get criteria for course
$completion = new completion_info($course);
@@ -492,13 +495,10 @@ function csv_quote($value) {
switch ($criterion->criteriatype) {
case COMPLETION_CRITERIA_TYPE_ACTIVITY:
- // Load activity
- $activity = $criterion->get_mod_instance();
-
// Display icon
$icon = $OUTPUT->pix_url('icon', $criterion->module);
$iconlink = $CFG->wwwroot.'/mod/'.$criterion->module.'/view.php?id='.$criterion->moduleinstance;
- $icontitle = $activity->name;
+ $icontitle = $modinfo->cms[$criterion->moduleinstance]->name;
$iconalt = get_string('modulename', $criterion->module);
break;
@@ -577,10 +577,7 @@ function csv_quote($value) {
if ($criterion->criteriatype == COMPLETION_CRITERIA_TYPE_ACTIVITY) {
// Load activity
- $mod = $criterion->get_mod_instance();
- $activity = $DB->get_record('course_modules', array('id' => $criterion->moduleinstance));
- $activity->name = $mod->name;
-
+ $activity = $modinfo->cms[$criterion->moduleinstance];
// Get progress information and state
if (array_key_exists($activity->id,$user->progress)) {
Please sign in to comment.
Something went wrong with that request. Please try again.