From da8a0c97f0546df68f562ac2e52dcf678514b83d Mon Sep 17 00:00:00 2001 From: David Monllao Date: Fri, 20 Oct 2017 11:16:53 +0200 Subject: [PATCH] MDL-60596 analytics: Check cm completion if available Previous code was restricted to course modules origin. --- course/classes/analytics/indicator/completion_enabled.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/course/classes/analytics/indicator/completion_enabled.php b/course/classes/analytics/indicator/completion_enabled.php index f2598e080da..87d09199c19 100644 --- a/course/classes/analytics/indicator/completion_enabled.php +++ b/course/classes/analytics/indicator/completion_enabled.php @@ -69,10 +69,8 @@ class completion_enabled extends \core_analytics\local\indicator\binary { $course = $this->retrieve('course', $sampleid); - $cm = false; - if ($sampleorigin === 'course_modules') { - $cm = $this->retrieve('course_modules', $sampleid); - } + // It may not be available, but if it is the indicator checks if completion is enabled for the cm. + $cm = $this->retrieve('course_modules', $sampleid); $completion = new \completion_info($course);