MDL-65993 analytics: Fix --filter option for by_course models
authorDavid Monllaó <davidm@moodle.com>
Fri, 21 Jun 2019 08:15:51 +0000 (10:15 +0200)
committerDavid Monllaó <davidm@moodle.com>
Wed, 14 Aug 2019 06:30:20 +0000 (14:30 +0800)
analytics/classes/local/analyser/by_course.php

index 99e70c1..c0d308b 100644 (file)
@@ -50,12 +50,11 @@ abstract class by_course extends base {
         if (!empty($this->options['filter'])) {
             $courses = array();
             foreach ($this->options['filter'] as $courseid) {
-                $courses[$courseid] = new \stdClass();
-                $courses[$courseid]->id = $courseid;
+                $courses[$courseid] = intval($courseid);
             }
 
             list($coursesql, $courseparams) = $DB->get_in_or_equal($courses, SQL_PARAMS_NAMED);
-            $sql .= " AND c.id IN $coursesql";
+            $sql .= " AND c.id $coursesql";
             $params = $params + $courseparams;
         }