korbit-ai[bot] commented on code in PR #33348:
URL: https://github.com/apache/superset/pull/33348#discussion_r2072312462
##########
superset-frontend/plugins/plugin-chart-echarts/src/Pie/buildQuery.ts:
##########
@@ -16,14 +16,30 @@
* specific language governing permissions and limitations
* under the License.
*/
-import { buildQueryContext, QueryFormData } from '@superset-ui/core';
+import {
+ buildQueryContext,
+ getMetricLabel,
+ QueryFormData,
+} from '@superset-ui/core';
+import { getContributionLabel } from './utils';
export default function buildQuery(formData: QueryFormData) {
const { metric, sort_by_metric } = formData;
+ const metricLabel = getMetricLabel(metric);
+
return buildQueryContext(formData, baseQueryObject => [
{
...baseQueryObject,
...(sort_by_metric && { orderby: [[metric, false]] }),
+ post_processing: [
+ {
+ operation: 'contribution',
+ options: {
+ columns: [metricLabel],
+ rename_columns: [getContributionLabel(metricLabel)],
+ },
+ },
+ ],
},
]);
}
Review Comment:
Fair point - in this specific case, the function is focused enough and
splitting it would add unnecessary complexity. I'll retract that suggestion.
--
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]