MDL-47631 report_participation: fixed filtering by letter

This commit is contained in:
Sam Hemelryk
2014-10-13 12:27:48 +13:00
parent d3ff82257e
commit 0e6d8ed261
+4 -3
View File
@@ -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();
}