From 9a8f8c857474eeb126fa6868ac1b0e0a05407262 Mon Sep 17 00:00:00 2001 From: Saurabh Kumar Bajpai Date: Thu, 6 Aug 2026 17:01:22 +0530 Subject: [PATCH] fix: resolve 4 bugs in devtrack --- src/app/api/metrics/activity/route.ts | 2 +- src/app/api/metrics/community-engagement/route.ts | 3 ++- src/app/api/metrics/productive-hours/route.ts | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/app/api/metrics/activity/route.ts b/src/app/api/metrics/activity/route.ts index 648696291..d41540543 100644 --- a/src/app/api/metrics/activity/route.ts +++ b/src/app/api/metrics/activity/route.ts @@ -167,7 +167,7 @@ export async function GET(req: NextRequest) { let limit = limitParam ? parseInt(limitParam, 10) : 10; let offset = offsetParam ? parseInt(offsetParam, 10) : 0; - if (isNaN(limit) || limit < 1) limit = 10; + if (Number.isNaN(limit) || limit < 1) limit = 10; if (limit > 100) limit = 100; if (isNaN(offset) || offset < 0) offset = 0; diff --git a/src/app/api/metrics/community-engagement/route.ts b/src/app/api/metrics/community-engagement/route.ts index d5cfb5166..1fb76e4db 100644 --- a/src/app/api/metrics/community-engagement/route.ts +++ b/src/app/api/metrics/community-engagement/route.ts @@ -267,4 +267,5 @@ export async function GET(req: NextRequest) { ); return Response.json({ badges }); -} \ 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/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");