fix: KPIs leen ad_daily desde ene 2025 para YoY completo
El lookback fijo de 420 días cortaba el histórico; ahora cubre desde 2025-01-01. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -20,8 +20,11 @@ import { isAgencyRole, serviceHeaders, supabaseUrl, userRole } from '@/lib/agenc
|
|||||||
|
|
||||||
export const dynamic = 'force-dynamic';
|
export const dynamic = 'force-dynamic';
|
||||||
|
|
||||||
/** Enough history for YoY on ad-level Meta rows (can be dense). */
|
/** Enough history for YoY from Jan 2025 (inclusive). */
|
||||||
const AD_DAILY_LOOKBACK_DAYS = 420;
|
const AD_DAILY_LOOKBACK_DAYS = Math.max(
|
||||||
|
700,
|
||||||
|
Math.ceil((Date.now() - Date.UTC(2025, 0, 1)) / 86400000) + 14
|
||||||
|
);
|
||||||
const AD_DAILY_PAGE = 1000;
|
const AD_DAILY_PAGE = 1000;
|
||||||
|
|
||||||
async function fetchAdDaily(
|
async function fetchAdDaily(
|
||||||
|
|||||||
Reference in New Issue
Block a user