From 10379112456597a80181f283ecdbcf0696ca94be Mon Sep 17 00:00:00 2001 From: Saurabh Kumar Bajpai Date: Thu, 6 Aug 2026 01:40:15 +0530 Subject: [PATCH] fix: resolve 4 bugs in devtrack --- src/app/api/metrics/productive-hours/route.ts | 2 +- src/app/api/metrics/repo-health/route.ts | 2 +- src/app/api/project-tutor/route.ts | 3 ++- src/app/compare/[users]/page.tsx | 2 ++ 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/app/api/metrics/productive-hours/route.ts b/src/app/api/metrics/productive-hours/route.ts index 5bb62d383..839a900c4 100644 --- a/src/app/api/metrics/productive-hours/route.ts +++ b/src/app/api/metrics/productive-hours/route.ts @@ -223,7 +223,7 @@ export async function GET(req: NextRequest) { } else { const daysParam = searchParams.get("days"); const parsedDays = daysParam ? parseInt(daysParam, 10) : NaN; - days = isNaN(parsedDays) ? 90 : Math.max(1, Math.min(365, parsedDays)); + days = Number.isNaN(parsedDays) ? 90 : Math.max(1, Math.min(365, parsedDays)); } const accountId = searchParams.get("accountId"); diff --git a/src/app/api/metrics/repo-health/route.ts b/src/app/api/metrics/repo-health/route.ts index 8e059da02..058acefe7 100644 --- a/src/app/api/metrics/repo-health/route.ts +++ b/src/app/api/metrics/repo-health/route.ts @@ -150,7 +150,7 @@ export async function GET(req: NextRequest) { return Response.json({ error: "Unauthorized" }, { status: 401 }); } - const requestedDays = parseInt(req.nextUrl.searchParams.get("days") ?? "30", 10); + const requestedDays = parseInt(req.nextUrl.searchParams.get("days", 10) ?? "30", 10); // Only allow 7, 30, or 90 day windows — other values default to 30. const days = requestedDays === 7 || requestedDays === 30 || requestedDays === 90 ? requestedDays : 30; diff --git a/src/app/api/project-tutor/route.ts b/src/app/api/project-tutor/route.ts index a9d803b15..e71433c1a 100644 --- a/src/app/api/project-tutor/route.ts +++ b/src/app/api/project-tutor/route.ts @@ -163,4 +163,5 @@ Give a clear, concise answer focused on interview preparation. Keep it under 200 console.error("Project tutor error:", error); return NextResponse.json({ error: "Something went wrong" }, { status: 500 }); } -} \ No newline at end of file +} +.catch(err => console.error("Promise.all failed:", err)); \ No newline at end of file diff --git a/src/app/compare/[users]/page.tsx b/src/app/compare/[users]/page.tsx index fa4e35efe..280156d54 100644 --- a/src/app/compare/[users]/page.tsx +++ b/src/app/compare/[users]/page.tsx @@ -419,3 +419,5 @@ function ReposCard({ username, repos }: { username: string; repos: TopRepo[] }) ); } + +.catch(err => console.error("Promise.all failed:", err)); \ No newline at end of file