From eea6a8ed4fb9a5ad9103ce4a6df7a6ed313eabe1 Mon Sep 17 00:00:00 2001 From: John Bodley <4567245+john-bodley@users.noreply.github.com> Date: Wed, 8 Nov 2023 12:22:00 -0800 Subject: [PATCH] fix(table): Double percenting ad-hoc percentage metrics (#25857) (cherry picked from commit 784a478268fd89e6e58077e99bb2010987d6b07c) --- .../plugins/plugin-chart-table/src/transformProps.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/superset-frontend/plugins/plugin-chart-table/src/transformProps.ts b/superset-frontend/plugins/plugin-chart-table/src/transformProps.ts index 3c9c00d3c165f..0c8970737d86d 100644 --- a/superset-frontend/plugins/plugin-chart-table/src/transformProps.ts +++ b/superset-frontend/plugins/plugin-chart-table/src/transformProps.ts @@ -118,9 +118,10 @@ const processColumns = memoizeOne(function processColumns( // because users can also add things like `MAX(str_col)` as a metric. const isMetric = metricsSet.has(key) && isNumeric(key, records); const isPercentMetric = percentMetricsSet.has(key); - const label = isPercentMetric - ? `%${verboseMap?.[key.replace('%', '')] || key}` - : verboseMap?.[key] || key; + const label = + isPercentMetric && verboseMap?.hasOwnProperty(key.replace('%', '')) + ? `%${verboseMap[key.replace('%', '')]}` + : verboseMap?.[key] || key; const isTime = dataType === GenericDataType.TEMPORAL; const isNumber = dataType === GenericDataType.NUMERIC; const savedFormat = columnFormats?.[key];