MDL-64057 core_message: fix bug with favourite count aggregation
authorJake Dallimore <jake@moodle.com>
Fri, 23 Nov 2018 06:42:33 +0000 (14:42 +0800)
committerJake Dallimore <jake@moodle.com>
Fri, 23 Nov 2018 06:42:33 +0000 (14:42 +0800)
message/classes/api.php

index c42d69b..e3d8a22 100644 (file)
@@ -1524,7 +1524,7 @@ class api {
         $countsrs = $DB->get_recordset_sql($sql, $params);
         foreach ($countsrs as $key => $val) {
             if (!empty($val->itemtype)) {
-                $counts['favourites'] = $val->count;
+                $counts['favourites'] += $val->count;
                 continue;
             }
             $counts['types'][$val->type] = $val->count;