From 6e041e7f0f778caf94751466ffb04e7e481488ed Mon Sep 17 00:00:00 2001 From: Sergio Clebal Date: Wed, 29 Sep 2021 16:07:56 +0200 Subject: [PATCH 1/2] Error formatting FormulaWidget AVG values [sc-182582] --- packages/react-core/src/operations/aggregation/values.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-core/src/operations/aggregation/values.js b/packages/react-core/src/operations/aggregation/values.js index cdcebe55e..8a7879f01 100644 --- a/packages/react-core/src/operations/aggregation/values.js +++ b/packages/react-core/src/operations/aggregation/values.js @@ -20,5 +20,5 @@ export const aggregationFunctions = { [AggregationTypes.MIN]: (values, key) => min(values, key), [AggregationTypes.MAX]: (values, key) => max(values, key), [AggregationTypes.SUM]: (values, key) => sum(values, key), - [AggregationTypes.AVG]: (values, key) => sum(values, key) / values.length + [AggregationTypes.AVG]: (values, key) => sum(values, key) / (values.length || 1) }; From 60888b1d683bab19b78ea563fb2d23cd801952f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Velarde?= Date: Thu, 14 Oct 2021 17:12:58 +0200 Subject: [PATCH 2/2] Add note to changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a41b322e..aba349f10 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Not released - Use Material-UI createTheme instead of deprecated createMuiTheme [#187](https://github.com/CartoDB/carto-react/pull/187) +- Fix error formatting FormulaWidget (AVG) values with no features in current viewport [#186](https://github.com/CartoDB/carto-react/pull/186) - Add TimeSeriesWidget [#168](https://github.com/CartoDB/carto-react/pull/168) - Add NoDataAlert component [#188](https://github.com/CartoDB/carto-react/pull/188) and [#191](https://github.com/CartoDB/carto-react/pull/191) - Update echarts to v5 [#167](https://github.com/CartoDB/carto-react/pull/167)