fix(ui): total/count change as per the api response

This commit is contained in:
Shekar Siri 2025-01-07 10:54:01 +01:00
parent 65d83e91c5
commit 1fdaeeedec
2 changed files with 3 additions and 3 deletions

View file

@ -18,7 +18,7 @@ interface Props {
function SessionsBy(props: Props) { function SessionsBy(props: Props) {
const { metric = {}, data = { values: [] }, onClick = () => null, isTemplate } = props; const { metric = {}, data = { values: [] }, onClick = () => null, isTemplate } = props;
const [selected, setSelected] = React.useState<any>(null); const [selected, setSelected] = React.useState<any>(null);
const total = data.count; const total = data.total;
const { openModal, closeModal } = useModal(); const { openModal, closeModal } = useModal();
const modalMetric = React.useMemo(() => Object.assign(new Widget(), metric), [metric]); const modalMetric = React.useMemo(() => Object.assign(new Widget(), metric), [metric]);

View file

@ -314,9 +314,9 @@ export default class Widget {
} else if (this.metricType === FUNNEL) { } else if (this.metricType === FUNNEL) {
_data.funnel = new Funnel().fromJSON(_data); _data.funnel = new Funnel().fromJSON(_data);
} else if (this.metricType === TABLE) { } else if (this.metricType === TABLE) {
const total = data[0]['total']; // const total = data[0]['total'];
const count = data[0]['count']; 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 { } else {
if (data.hasOwnProperty('chart')) { if (data.hasOwnProperty('chart')) {
_data['value'] = data.value; _data['value'] = data.value;