perf: acortar lookback KPIs y unificar fallback Google warehouse

Quita el suelo de 700 días (basta desde ene-2025) y deja buildGoogleCardsFromDaily solo en ad-creatives-google.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
4Ventures
2026-09-29 09:36:41 +02:00
parent a75f3ae30c
commit 82a910330d
3 changed files with 4 additions and 38 deletions

View File

@@ -20,11 +20,9 @@ import { isAgencyRole, serviceHeaders, supabaseUrl, userRole } from '@/lib/agenc
export const dynamic = 'force-dynamic';
/** Enough history for YoY from Jan 2025 (inclusive). */
const AD_DAILY_LOOKBACK_DAYS = Math.max(
700,
Math.ceil((Date.now() - Date.UTC(2025, 0, 1)) / 86400000) + 14
);
/** Enough history for YoY from Jan 2025 (inclusive). No artificial 700d floor. */
const AD_DAILY_LOOKBACK_DAYS =
Math.ceil((Date.now() - Date.UTC(2025, 0, 1)) / 86400000) + 14;
const AD_DAILY_PAGE = 1000;
async function fetchAdDaily(