Conversation
* 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
…ts, label by default
mattab
pushed a commit
that referenced
this pull request
Mar 17, 2015
Fix Sort filters are sometimes applied multiple times
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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::$defaultSortColumnas 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_visitsand as a secondary column bylabel. This was not the case before.