codeant-ai-for-open-source[bot] commented on code in PR #44815:
URL: https://github.com/apache/superset/pull/44815#discussion_r4158855773
##########
superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/utilities.ts:
##########
@@ -1130,6 +1133,24 @@ class PivotData {
return fmtAggs[groupName][String(groupValue)] || this.aggregator;
}
+ /*
+ * Push a record into the grand-total slot, creating the slot on first use.
+ *
+ * The grand total has no key of its own, so -- exactly like rowTotals and
+ * colTotals -- its aggregator is built from the first record that reaches
it,
+ * which lets it pick up that record's per-metric formatter. Building it in
the
+ * constructor from `this.aggregator` instead (as this used to) pins it to
+ * `defaultFormatter`, so a metric configured with a currency or custom d3
+ * format had its total render as a bare number while its body cells rendered
+ * as money.
+ */
+ pushAllTotal(record: PivotRecord) {
+ if (!this.allTotal) {
+ this.allTotal = this.getFormattedAggregator(record)(this, [], []);
+ }
+ this.allTotal.push(record);
+ }
Review Comment:
✅ **CodeAnt verified this suggestion was addressed in subsequent commits and
marked this thread resolved** as of `3c776fa`.
`pushAllTotal` now derives the formatter for each record and rebuilds
`allTotal` whenever that formatter changes, tracking it in `allTotalFormatter`.
This prevents a later metric's value from being rendered with the previous
metric's formatter.
<sub>If that's not right, unresolve this thread and CodeAnt will leave it
open.</sub>
<!-- codeant-auto-resolve-reply -->
--
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]