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 22d04436c0
commit adf27d4cb7
2 changed files with 3 additions and 3 deletions

View file

@ -18,7 +18,7 @@ interface Props {
function SessionsBy(props: Props) {
const { metric = {}, data = { values: [] }, onClick = () => null, isTemplate } = props;
const [selected, setSelected] = React.useState<any>(null);
const total = data.count;
const total = data.total;
const { openModal, closeModal } = useModal();
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) {
_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;