MDL-66076 forumreport_summary: Added missing SQL group by fields
authorMichael Hawkins <michaelh@moodle.com>
Wed, 9 Oct 2019 02:44:39 +0000 (10:44 +0800)
committerJun Pataleta <jun@moodle.com>
Fri, 11 Oct 2019 03:09:50 +0000 (11:09 +0800)
Also removed a redundant variable declaration.

mod/forum/report/summary/classes/summary_table.php

index 1db6814..2aff436 100644 (file)
@@ -430,7 +430,7 @@ class summary_table extends table_sql {
 
         $this->sql->basewhere = 'e.courseid = :courseid';
 
-        $this->sql->basegroupby = 'ue.userid, e.courseid, f.id, u.id';
+        $this->sql->basegroupby = 'ue.userid, e.courseid, f.id, u.id, ' . $userfieldssql;
 
         if ($this->logreader) {
             $this->fill_log_summary_temp_table($this->context->id);
@@ -526,7 +526,6 @@ class summary_table extends table_sql {
      * @return string The complete SQL statement.
      */
     protected function get_full_sql(bool $fullselect = true): string {
-        $selectfields = '';
         $groupby = '';
         $orderby = '';