From e4f14a24b7404897149f615f04ea654c02d971bf Mon Sep 17 00:00:00 2001 From: BOHA Date: Wed, 29 Apr 2026 16:50:20 +0200 Subject: [PATCH] fix: handle plain month number in attendance route, not just YYYY-MM AttendanceAdmin sends ?year=YYYY&month=M (separate params), but the route handler assumed month was always in "YYYY-MM" format. When query.month was just "4", the split produced NaN for month and 4 for year, causing the service to skip the month filter entirely. Co-Authored-By: Claude Opus 4.7 --- package.json | 2 +- src/routes/admin/attendance.ts | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 28ab37a..e97bff9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "app-ts", - "version": "1.6.0", + "version": "1.6.1", "description": "", "main": "dist/server.js", "scripts": { diff --git a/src/routes/admin/attendance.ts b/src/routes/admin/attendance.ts index 126d3cd..743c0d1 100644 --- a/src/routes/admin/attendance.ts +++ b/src/routes/admin/attendance.ts @@ -221,10 +221,16 @@ export default async function attendanceRoutes( isAdmin, authUserId: authData.userId, month: query.month - ? Number(String(query.month).split("-")[1]) + ? String(query.month).includes("-") + ? Number(String(query.month).split("-")[1]) + : Number(query.month) : undefined, year: query.month - ? Number(String(query.month).split("-")[0]) + ? String(query.month).includes("-") + ? Number(String(query.month).split("-")[0]) + : query.year + ? Number(query.year) + : undefined : query.year ? Number(query.year) : undefined,