MDL-58577 stats: Correct groupby when getting report options
authorAndrew Nicols <andrew@nicols.co.uk>
Tue, 23 May 2017 11:40:35 +0000 (19:40 +0800)
committerAndrew Nicols <andrew@nicols.co.uk>
Tue, 23 May 2017 11:40:37 +0000 (19:40 +0800)
lib/statslib.php

index 73a5d5d..9dd95ca 100644 (file)
@@ -1402,7 +1402,7 @@ function stats_get_report_options($courseid,$mode) {
         $reportoptions[STATS_REPORT_ACTIVITY] = get_string('statsreport'.STATS_REPORT_ACTIVITY);
         if ($courseid != SITEID && $context = context_course::instance($courseid)) {
             $sql = 'SELECT r.id, r.name, r.shortname FROM {role} r JOIN {stats_daily} s ON s.roleid = r.id
-                 WHERE s.courseid = :courseid GROUP BY r.id, r.name';
+                 WHERE s.courseid = :courseid GROUP BY r.id, r.name, r.shortname';
             if ($roles = $DB->get_records_sql($sql, array('courseid' => $courseid))) {
                 foreach ($roles as $role) {
                     $reportoptions[STATS_REPORT_ACTIVITYBYROLE.$role->id] = get_string('statsreport'.STATS_REPORT_ACTIVITYBYROLE).