From ff0c825a7bca7adaad0bc492ab3d910703b8f3a2 Mon Sep 17 00:00:00 2001 From: Francis Cao Date: Tue, 27 Aug 2024 17:07:43 -0700 Subject: [PATCH] fix retention report dates and days --- src/app/(main)/reports/retention/RetentionTable.tsx | 2 +- src/queries/analytics/reports/getRetention.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/(main)/reports/retention/RetentionTable.tsx b/src/app/(main)/reports/retention/RetentionTable.tsx index acc9c052b8..6d825567d4 100644 --- a/src/app/(main)/reports/retention/RetentionTable.tsx +++ b/src/app/(main)/reports/retention/RetentionTable.tsx @@ -58,7 +58,7 @@ export function RetentionTable({ days = DAYS }) { if (totalDays - rowIndex < day) { return null; } - const percentage = records[day]?.percentage; + const percentage = records.filter(a => a.day === day)[0]?.percentage; return (
{ const { startDate, endDate, timezone = 'UTC' } = filters; - const { getDateSQL, getDateStringSQL, rawQuery } = clickhouse; + const { getDateSQL, rawQuery } = clickhouse; const unit = 'day'; return rawQuery( @@ -152,7 +152,7 @@ async function clickhouseQuery( group by 1, 2 ) select - ${getDateStringSQL('c.cohort_date', unit)} as date, + c.cohort_date as date, c.day_number as day, s.visitors as visitors, c.visitors returnVisitors,