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:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "app-ts",
|
"name": "app-ts",
|
||||||
"version": "1.6.0",
|
"version": "1.6.1",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "dist/server.js",
|
"main": "dist/server.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -221,10 +221,16 @@ export default async function attendanceRoutes(
|
|||||||
isAdmin,
|
isAdmin,
|
||||||
authUserId: authData.userId,
|
authUserId: authData.userId,
|
||||||
month: query.month
|
month: query.month
|
||||||
|
? String(query.month).includes("-")
|
||||||
? Number(String(query.month).split("-")[1])
|
? Number(String(query.month).split("-")[1])
|
||||||
|
: Number(query.month)
|
||||||
: undefined,
|
: undefined,
|
||||||
year: query.month
|
year: query.month
|
||||||
|
? String(query.month).includes("-")
|
||||||
? Number(String(query.month).split("-")[0])
|
? Number(String(query.month).split("-")[0])
|
||||||
|
: query.year
|
||||||
|
? Number(query.year)
|
||||||
|
: undefined
|
||||||
: query.year
|
: query.year
|
||||||
? Number(query.year)
|
? Number(query.year)
|
||||||
: undefined,
|
: undefined,
|
||||||
|
|||||||
Reference in New Issue
Block a user