rusackas opened a new pull request, #42428:
URL: https://github.com/apache/superset/pull/42428

   ### SUMMARY
   When "Percentage metric calculation" is set to "Use all records" and "Show 
totals" is enabled, `buildQuery` inserts an extra query (used to compute 
percent metrics against the full result set) *ahead* of the totals query inside 
`queriesData`. `transformProps` picked the totals query by a fixed array index, 
so in this configuration it grabbed the percent-metrics-only query instead, and 
the summary/totals row ended up with the wrong values (and, since those values 
didn't line up with the columns' configured `d3NumberFormat`, effectively 
unformatted-looking numbers).
   
   This locates the totals query positionally (it's always the last entry in 
`queriesData` when present) instead of assuming a fixed index, so it's no 
longer displaced by the extra percent-metrics query.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   Not applicable — logic fix in query result wiring, not a visual/styling 
change.
   
   ### TESTING INSTRUCTIONS
   1. Create a Table chart in Aggregate mode with at least one metric and a 
percent metric.
   2. Set "Percentage metric calculation" to "Use all records".
   3. Enable "Show totals".
   4. Set a custom number format on a metric column via "Customize columns".
   5. Confirm the summary/totals row now reflects the correct total (and 
format) for that column, rather than a value pulled from the percent-metrics 
query.
   
   Also covered by a new unit test in 
`superset-frontend/plugins/plugin-chart-table/test/TableChart.test.tsx` that 
pins down the correct `totals` query is picked when the "all records" 
percent-metric query precedes it in `queriesData`.
   
   Note: I wasn't able to run the frontend test suite in this environment 
(broken/hanging local `node_modules`), so please treat CI as the source of 
truth here.
   
   ### ADDITIONAL INFORMATION
   - [x] Has associated issue: Fixes #39587
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to