From a6f1fd7957a917fb2da034e47a1f61461c2b9143 Mon Sep 17 00:00:00 2001 From: Saurabh Kumar Bajpai Date: Wed, 5 Aug 2026 17:41:05 +0530 Subject: [PATCH] fix: resolve 1 bugs in devtrack --- src/app/api/metrics/repo-analytics/route.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/api/metrics/repo-analytics/route.ts b/src/app/api/metrics/repo-analytics/route.ts index caf5e0946..a7a3fb6c4 100644 --- a/src/app/api/metrics/repo-analytics/route.ts +++ b/src/app/api/metrics/repo-analytics/route.ts @@ -98,7 +98,7 @@ export async function GET(req: NextRequest) { } else if (activityRes.ok) { const activityData = await activityRes.json(); if (Array.isArray(activityData) && activityData.length > 0) { - const lastWeek = activityData[activityData.length - 1]; + const lastWeek = activityData.at(-1); const days: number[] = lastWeek.days || []; // `lastWeek.week` is a Unix timestamp (seconds) for the Sunday that starts the bucket. // Derive labels from it so they always match the actual calendar days GitHub recorded.