Odd Simon Simonsen committed 9437969

0.12.3dev: Always sort report by `__group__` first if present.

It was wrong to make group order depend on a user column sort, and certainly when user sort is not supported for grouped reports. Without ordering by `__group__`, groups may appear twice or more as there is no guarantee that the outer query will return results in the same order as the subquery.

Comments (0)

Files changed (1)


             sort_col = req.args.get('sort', '')
             self.log.debug("Columns %r, Sort column %s" % (cols, sort_col))
             order_cols = []
+            if '__group__' in cols:
+                order_cols.append('__group__')
             if sort_col:
-                if '__group__' in cols:
-                    order_cols.append('__group__')
                 if sort_col in cols: