Fix sorting for ecommerce item reports #21863
Merged
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.
Description:
Sorting of ecommerce item reports currently does not work correctly in some case.
Sometimes when trying to sort for e.g. item views, the reports are sorted by label instead.
The reason for that can be found in the way the reports are built. As e.g. item view metrics are only added for those items that actually had any views tracked, not all rows the report contains the same set of columns.
The sorting is then currently broken, if the first row does not contain the column that was requested for sorting. See #21829 (comment) for further details.
This fix was the one with the lowest required effort. It might nevertheless be good to start a discussion at some point around how to ensure that all rows in a report contain the same set of columns, as this could lead to problems elsewhere as well.
fixes #21829
Review