bito-code-review[bot] commented on code in PR #42088:
URL: https://github.com/apache/superset/pull/42088#discussion_r3647977687
##########
superset-frontend/plugins/plugin-chart-ag-grid-table/src/buildQuery.ts:
##########
@@ -672,6 +672,29 @@ export const buildQueryUncached:
BuildQuery<TableChartFormData> = (
}
}
+ // Build the "all records" percent-metric denominator query AFTER all
+ // filter mutations (interactive group-by, search, AG Grid WHERE/HAVING)
+ // above, so its denominator reflects the same filtered result set as the
+ // main query instead of a stale pre-filter snapshot.
+ const calculationMode = formData.percent_metric_calculation || 'row_limit';
+
+ if (
+ calculationMode === 'all_records' &&
+ percentMetrics &&
+ percentMetrics.length > 0
+ ) {
+ extraQueries.push({
+ ...queryObject,
+ columns: [],
+ metrics: percentMetrics,
+ post_processing: [],
+ row_limit: 0,
+ row_offset: 0,
+ orderby: [],
+ is_timeseries: false,
+ });
+ }
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Missing test coverage</b></div>
<div id="fix">
The all_records percent-metric denominator query (lines 686-695) is placed
AFTER all filter mutations, matching the plugin-chart-table pattern. However,
no buildQuery test covers the scenario where both all_records mode and
show_totals are enabled with AG Grid filters present — the transformProps test
only verifies the queriesData post-processing, not the buildQuery extras
handling.
</div>
</div>
<small><i>Code Review Run #3a38dc</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
--
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]