MDL-58577 stats: Correct groupby when getting report options

This commit is contained in:
Andrew Nicols
2017-05-23 19:46:55 +08:00
parent bfc16e66a5
commit 85eacc3a31
+1 -1
View 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).