fix(browser): restore card-mode order_value caption for mixed-children groups#762
Merged
Merged
Conversation
…n groups The browser table-view PR (#745) routed group-row scalar / M2M sort through ``scalar_intersection_sort_expr`` / ``m2m_intersection_sort_expr`` for every view mode. Intersection returns NULL when a group's children disagree on the sorted field, which is correct for table view (sort matches the intersection cell display) but blanks the order_value caption beneath cover-mode cards for any group with mixed children. The user reported this for Publish Date across publishers, series, and folders. Gate the intersection branch on ``view_mode == "table"`` so cover mode falls back to the pre-table-view aggregate (Min/Max/Avg/Sum) for scalars and ``sort_name`` for M2M. Regression test reproduces the user's scenario: a "Mixed" series with children at year=2018 and year=2024 returned orderValue=null before; now returns "2018" (Min aggregate). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
scalar_intersection_sort_expr/m2m_intersection_sort_exprfor every view mode. Intersection returnsNULLwhen a group's children disagree on the sorted field — correct for table view (sort matches the intersection cell display) but it blanks theorder_valuecaption beneath cover-mode cards for any group with mixed children. The user reported this for Publish Date across publishers, series, and folders.view_mode == "table"in_group_scalar_order_valueand_group_m2m_order_valueso cover mode falls back to the pre-table-view aggregate (Min/Max/Avg/Sum) for scalars andsort_namefor M2M.orderValue: null; now it returns theMinaggregate.Why
In cover mode,
order_valueis the caption rendered beneath each browser card. The intersection rule is correct for table view (cell display matches sort) but is the wrong rule for cover view, where the caption is meant to show the aggregated value the rows are sorted by —Min(year)for ASC,Max(year)for DESC, etc. The table-view PR didn't gate by view mode, so cover-mode users started seeing blank captions for any mixed-children group.The
_extra_group_exprpath that also uses these intersection expressions is already correctly gated behind_should_annotate_extras(which checksview_mode == "table"), so no change is needed there.Test plan
test_cover_mode_group_order_value_uses_aggregate— verified it fails on the pre-fix code (Mixed series →orderValue=None) and passes after the fix (Mixed →"2018").test_year_sort_matches_intersection_displaystill passes (table-mode behavior unchanged).tests/test_browser_ordering.pypass.tests/test_browser_table_response.py,tests/test_browser_columns_registry.py,tests/test_browser_settings_table.pyall pass (84 tests).make lintclean.make tyclean.🤖 Generated with Claude Code