From d3046f1761b7018d828c5179efafb3d97583cd65 Mon Sep 17 00:00:00 2001 From: Sam Hemelryk Date: Mon, 13 Oct 2014 12:27:17 +1300 Subject: [PATCH] MDL-47631 report_participation: fixed filtering by letter --- report/participation/index.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/report/participation/index.php b/report/participation/index.php index af8334e3dd7..c097b6704ff 100644 --- a/report/participation/index.php +++ b/report/participation/index.php @@ -278,8 +278,9 @@ if (!empty($instanceid) && !empty($roleid)) { AND anonymous = 0 AND contextlevel = :contextlevel AND (origin = 'web' OR origin = 'ws') - GROUP BY userid,timecreated) l ON (l.userid = ra.userid) - GROUP BY ra.userid, $usernamefields, u.idnumber"; + GROUP BY userid,timecreated) l ON (l.userid = ra.userid)"; + // We add this after the WHERE statement that may come below. + $groupbysql = " GROUP BY ra.userid, $usernamefields, u.idnumber"; $params['edulevel'] = core\event\base::LEVEL_PARTICIPATING; $params['contextlevel'] = CONTEXT_MODULE; @@ -287,7 +288,7 @@ if (!empty($instanceid) && !empty($roleid)) { if ($twhere) { $sql .= ' WHERE '.$twhere; // Initial bar. } - + $sql .= $groupbysql; if ($table->get_sql_sort()) { $sql .= ' ORDER BY '.$table->get_sql_sort(); }