From 13b796c0ea2abe1dc177afcebf3c5794d135a175 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Fri, 19 Jun 2026 00:52:34 +0000 Subject: [PATCH] fix: add total_projects to API response for correct feature adoption denominator; remove unreachable revenue_growth sort key - feature_adoption[].projects_using is counted over ALL projects server-side, but the client was using data.projects.length (capped at LEADERBOARD_LIMIT=500) as the denominator. Now the backend sends total_projects = projectRows.length and the client uses that for the percentage calculation. - Removed dead revenue_growth SortKey variant that had no corresponding column header button. Co-Authored-By: mantra --- .../app/api/latest/internal/platform-analytics/route.tsx | 3 +++ .../[projectId]/platform-analytics/page-client.tsx | 8 +++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/apps/backend/src/app/api/latest/internal/platform-analytics/route.tsx b/apps/backend/src/app/api/latest/internal/platform-analytics/route.tsx index bdae98f5d..83255964e 100644 --- a/apps/backend/src/app/api/latest/internal/platform-analytics/route.tsx +++ b/apps/backend/src/app/api/latest/internal/platform-analytics/route.tsx @@ -160,6 +160,7 @@ export const GET = createSmartRouteHandler({ }).defined(), dead_click_rate: yupNumber().defined(), }).defined(), + total_projects: yupNumber().integer().defined(), feature_adoption: yupArray(yupObject({ feature: yupString().defined(), projects_using: yupNumber().integer().defined(), @@ -673,6 +674,7 @@ export const GET = createSmartRouteHandler({ series, activity_split, breakdowns, + total_projects: projectRows.length, feature_adoption, projects: projects.slice(0, LEADERBOARD_LIMIT), }, @@ -706,6 +708,7 @@ function emptyBody(now: Date) { email: { sent: 0, delivered: 0, bounced: 0, error: 0, in_progress: 0 }, dead_click_rate: 0, }, + total_projects: 0, feature_adoption: [], projects: [], }; diff --git a/apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/platform-analytics/page-client.tsx b/apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/platform-analytics/page-client.tsx index cef2dc0e0..61b655765 100644 --- a/apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/platform-analytics/page-client.tsx +++ b/apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/platform-analytics/page-client.tsx @@ -79,6 +79,7 @@ type PlatformAnalytics = { email: { sent: number, delivered: number, bounced: number, error: number, in_progress: number }, dead_click_rate: number, }, + total_projects: number, feature_adoption: Array<{ feature: string, projects_using: number }>, projects: ProjectRow[], }; @@ -326,7 +327,7 @@ function Dashboard({
- +
@@ -439,7 +440,7 @@ function projectStatus(project: ProjectRow, windowDays: number): string { return "Flat"; } -type SortKey = "total_users" | "verified" | "active_users" | "signups" | "signup_growth" | "revenue" | "revenue_growth"; +type SortKey = "total_users" | "verified" | "active_users" | "signups" | "signup_growth" | "revenue"; function ProjectLeaderboard({ projects, windowDays }: { projects: ProjectRow[], windowDays: number }) { const [sortKey, setSortKey] = useState("total_users"); @@ -463,9 +464,6 @@ function ProjectLeaderboard({ projects, windowDays }: { projects: ProjectRow[], case "revenue": { return p.revenue_cents; } - case "revenue_growth": { - return growthPct(p.revenue_cents, p.revenue_cents_prev) ?? -Infinity; - } default: { return p.total_users; }