From ccbb7adafef3c41f75a762bc0d0f7a0eb953ff43 Mon Sep 17 00:00:00 2001 From: Saurabh Kumar Bajpai Date: Thu, 6 Aug 2026 09:30:14 +0530 Subject: [PATCH] fix: resolve 4 bugs in devtrack --- src/app/api/metrics/prs/route.ts | 2 +- src/app/api/metrics/repo-health/route.ts | 2 +- src/app/api/personality/route.ts | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/app/api/metrics/prs/route.ts b/src/app/api/metrics/prs/route.ts index b5f734133..780945cf1 100644 --- a/src/app/api/metrics/prs/route.ts +++ b/src/app/api/metrics/prs/route.ts @@ -158,7 +158,7 @@ async function getAverageFirstReviewHours( if (validDurations.length === 0) return null; const average = validDurations.reduce((sum, value) => sum + value, 0) / validDurations.length; - return Math.round(average * 10) / 10; + return Math.round(average * 10 + Number.EPSILON) / 10; } async function fetchPRMetrics( 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/personality/route.ts b/src/app/api/personality/route.ts index 29ce79ea0..f8d015685 100644 --- a/src/app/api/personality/route.ts +++ b/src/app/api/personality/route.ts @@ -292,4 +292,5 @@ export async function GET(request: Request) { ); return NextResponse.json({ data: report, cached: false }); -} \ No newline at end of file +} +.catch(err => console.error("Promise.all failed:", err)); \ No newline at end of file