Fix Sort filters are sometimes applied multiple times #7452
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
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 bylabel
. This was not the case before.