@tsteur opened this Pull Request on March 17th 2015 Owner

see #7388

We should only apply a sort filter once, meaning it will be much faster since a sort takes a long time on many rows (many seconds under circumstances). The only way to apply the filter only once is by applying it in GenericFilters. This means we will fallback to a default sort column, specified in a report class, if no column was specifically set.

This does not yet actually fix the issue #7388 . We should probably also apply the default sort column to more reports such as Actions. We might also expose more settings to a report like "defaultSortOrder", "preferNaturalSort", ... This is to be discussed. I do not want to expose this Report::$defaultSortColumn as an API yet since I am not sure whether this is the best solution. We probably need a 'DefaultSortConfig` for reports that allows to specify "defaultSortOrder", "preferNaturalSort", "defaultSortColumn", "defaultSecondarySortColumn", ... once we merge #7420 and work on #7401. Further steps are to be discussed.

Please note that this also fixes some issues in the Sort filter. I could have created a separate pull request for it, but it was kinda needed to fix it here since otherwise it would sometimes return a wrong result. Some fixed bugs include:

  • make sure to select correct column (the column value might be false which is valid, meaning column actually exists whereas we assumed before it does not exist)
  • use correct sort algorithm (if value of first column was false we picked under circumstances a string comparison instead of number)
  • If we sort by label, use always a string or natural comparison even if the label is numeric

I had to update the expected system tests but it seems to be a valid change. By default we do now sort by nb_visits and as a secondary column by label. This was not the case before.

This Pull Request was closed on March 17th 2015
Powered by GitHub Issue Mirror