Align Ads and Métricas on the same paginated ad_daily warehouse.

Ad Tracker only loaded 2000 newest rows, so Brava showed 0 € while Métricas summed the full month. Both now page the same table for the selected range.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
4Ventures
2026-10-06 15:33:06 +02:00
parent fac9867202
commit a5bfec698b
6 changed files with 181 additions and 74 deletions

View File

@@ -361,8 +361,10 @@ export default function MetricsDashboard({
const periodTotals = useMemo(() => {
let base: MetricTotals;
if (rangedDaily.length) {
base = metricTotalsFromDaily(rangedDaily);
if (dailyRows.length) {
base = rangedDaily.length
? metricTotalsFromDaily(rangedDaily)
: metricTotalsFromDaily([]);
} else {
const ranged = weeklyRows.filter((r) => {
if (!r.week) return false;
@@ -372,7 +374,7 @@ export default function MetricsDashboard({
base = ranged.length ? sumWeekly(ranged) : month;
}
return withCohortFromDeals(base, rangedDeals);
}, [rangedDaily, rangedDeals, weeklyRows, since, until, month]);
}, [dailyRows.length, rangedDaily, rangedDeals, weeklyRows, since, until, month]);
const rangeDeltas = useMemo(
() => buildRangeDeltas(dailyRows, wonDeals, since, until),