From 1fdaeeedec3a28ef65b71089b2e5e03a1de1ac3f Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Tue, 7 Jan 2025 10:54:01 +0100 Subject: [PATCH] fix(ui): total/count change as per the api response --- .../Dashboard/Widgets/CustomMetricsWidgets/SessionsBy.tsx | 2 +- frontend/app/mstore/types/widget.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/SessionsBy.tsx b/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/SessionsBy.tsx index 5bf913ea1..b54b8c563 100644 --- a/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/SessionsBy.tsx +++ b/frontend/app/components/Dashboard/Widgets/CustomMetricsWidgets/SessionsBy.tsx @@ -18,7 +18,7 @@ interface Props { function SessionsBy(props: Props) { const { metric = {}, data = { values: [] }, onClick = () => null, isTemplate } = props; const [selected, setSelected] = React.useState(null); - const total = data.count; + const total = data.total; const { openModal, closeModal } = useModal(); const modalMetric = React.useMemo(() => Object.assign(new Widget(), metric), [metric]); diff --git a/frontend/app/mstore/types/widget.ts b/frontend/app/mstore/types/widget.ts index 5745a5a90..94ae08fe2 100644 --- a/frontend/app/mstore/types/widget.ts +++ b/frontend/app/mstore/types/widget.ts @@ -314,9 +314,9 @@ export default class Widget { } else if (this.metricType === FUNNEL) { _data.funnel = new Funnel().fromJSON(_data); } else if (this.metricType === TABLE) { - const total = data[0]['total']; + // const total = data[0]['total']; const count = data[0]['count']; - _data[0]['values'] = data[0]['values'].map((s: any) => new SessionsByRow().fromJson(s, total, this.metricOf)); + _data[0]['values'] = data[0]['values'].map((s: any) => new SessionsByRow().fromJson(s, count, this.metricOf)); } else { if (data.hasOwnProperty('chart')) { _data['value'] = data.value;