refactor(reports): drop txns_per_month and Count card
Group strip is now Sum/Avg/Min/Max/Cadence-Frequency; count already shown in the accordion header, per-month rate derivable from monthly buckets.
This commit is contained in:
@@ -162,7 +162,6 @@ export function ReportViewer({ id, version, fields, onClose, onRegenerated }: Re
|
|||||||
max: g.metrics.max,
|
max: g.metrics.max,
|
||||||
cadence: g.metrics.cadence,
|
cadence: g.metrics.cadence,
|
||||||
frequency: g.metrics.frequency,
|
frequency: g.metrics.frequency,
|
||||||
txnsPerMonth: g.metrics.txnsPerMonth,
|
|
||||||
},
|
},
|
||||||
})),
|
})),
|
||||||
[periodGroups],
|
[periodGroups],
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ export interface PeriodMetricsVM {
|
|||||||
lastDate: string | null;
|
lastDate: string | null;
|
||||||
cadence: number | null;
|
cadence: number | null;
|
||||||
frequency: number | null;
|
frequency: number | null;
|
||||||
txnsPerMonth: number | null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ReportPeriodGroup {
|
export interface ReportPeriodGroup {
|
||||||
@@ -109,7 +108,6 @@ export function buildPeriodGroups(buckets: any[], filter: SliceFilter): ReportPe
|
|||||||
sources: number;
|
sources: number;
|
||||||
apiCadence: number | null;
|
apiCadence: number | null;
|
||||||
apiFrequency: number | null;
|
apiFrequency: number | null;
|
||||||
apiTxnsPerMonth: number | null;
|
|
||||||
}
|
}
|
||||||
const byPeriod = new Map<string, Acc>();
|
const byPeriod = new Map<string, Acc>();
|
||||||
const seenTxnIds = new Set<string>();
|
const seenTxnIds = new Set<string>();
|
||||||
@@ -135,13 +133,11 @@ export function buildPeriodGroups(buckets: any[], filter: SliceFilter): ReportPe
|
|||||||
lastDate: null,
|
lastDate: null,
|
||||||
cadence: null,
|
cadence: null,
|
||||||
frequency: null,
|
frequency: null,
|
||||||
txnsPerMonth: null,
|
|
||||||
},
|
},
|
||||||
txns: [],
|
txns: [],
|
||||||
sources: 0,
|
sources: 0,
|
||||||
apiCadence: num(m.cadence),
|
apiCadence: num(m.cadence),
|
||||||
apiFrequency: num(m.frequency),
|
apiFrequency: num(m.frequency),
|
||||||
apiTxnsPerMonth: num(m.txns_per_month),
|
|
||||||
};
|
};
|
||||||
byPeriod.set(period.period_id, acc);
|
byPeriod.set(period.period_id, acc);
|
||||||
}
|
}
|
||||||
@@ -192,11 +188,9 @@ export function buildPeriodGroups(buckets: any[], filter: SliceFilter): ReportPe
|
|||||||
vm.cadence = null;
|
vm.cadence = null;
|
||||||
vm.frequency = null;
|
vm.frequency = null;
|
||||||
}
|
}
|
||||||
vm.txnsPerMonth = null;
|
|
||||||
} else {
|
} else {
|
||||||
vm.cadence = acc.apiCadence;
|
vm.cadence = acc.apiCadence;
|
||||||
vm.frequency = acc.apiFrequency;
|
vm.frequency = acc.apiFrequency;
|
||||||
vm.txnsPerMonth = acc.apiTxnsPerMonth;
|
|
||||||
}
|
}
|
||||||
return { key, metrics: vm, txns: acc.txns, currency };
|
return { key, metrics: vm, txns: acc.txns, currency };
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ function txnFallbackMetrics(items: ExpenseItem[]): ListGroupMetrics {
|
|||||||
max: t.max,
|
max: t.max,
|
||||||
cadence: t.cadenceDays,
|
cadence: t.cadenceDays,
|
||||||
frequency: t.frequency,
|
frequency: t.frequency,
|
||||||
txnsPerMonth: null,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,18 +66,8 @@ function GroupMetrics({
|
|||||||
{ label: "Avg", value: m.avg == null ? "—" : formatCurrency(m.avg, currency) },
|
{ label: "Avg", value: m.avg == null ? "—" : formatCurrency(m.avg, currency) },
|
||||||
{ label: "Min", value: m.min == null ? "—" : formatCurrency(m.min, currency) },
|
{ label: "Min", value: m.min == null ? "—" : formatCurrency(m.min, currency) },
|
||||||
{ label: "Max", value: m.max == null ? "—" : formatCurrency(m.max, currency) },
|
{ label: "Max", value: m.max == null ? "—" : formatCurrency(m.max, currency) },
|
||||||
{
|
|
||||||
label: "Count",
|
|
||||||
value:
|
|
||||||
typeof m.count === "number"
|
|
||||||
? m.count.toLocaleString("en-IN")
|
|
||||||
: String(items.length),
|
|
||||||
},
|
|
||||||
cadenceRow(m.cadence, m.frequency),
|
cadenceRow(m.cadence, m.frequency),
|
||||||
];
|
];
|
||||||
if (m.txnsPerMonth != null) {
|
|
||||||
rows.push({ label: "Per Month", value: Number.isInteger(m.txnsPerMonth) ? String(m.txnsPerMonth) : m.txnsPerMonth.toFixed(2) });
|
|
||||||
}
|
|
||||||
return (
|
return (
|
||||||
<Box sx={{ display: "flex", gap: 2, flexWrap: "wrap", width: "100%" }}>
|
<Box sx={{ display: "flex", gap: 2, flexWrap: "wrap", width: "100%" }}>
|
||||||
{rows.map((row) => (
|
{rows.map((row) => (
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ export interface ListGroupMetrics {
|
|||||||
max: number | null;
|
max: number | null;
|
||||||
cadence: number | null;
|
cadence: number | null;
|
||||||
frequency: number | null;
|
frequency: number | null;
|
||||||
txnsPerMonth: number | null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ListPeriodGroup extends PeriodGroup {
|
export interface ListPeriodGroup extends PeriodGroup {
|
||||||
|
|||||||
Reference in New Issue
Block a user