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 <noreply@anthropic.com>
This commit is contained in:
BOHA
2026-04-29 16:50:20 +02:00
parent 3bd0d055d9
commit e4f14a24b7
2 changed files with 9 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "app-ts",
"version": "1.6.0",
"version": "1.6.1",
"description": "",
"main": "dist/server.js",
"scripts": {

View File

@@ -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,