fix(attendance): admin month view no longer truncates at 100 records

The KPI cards and on-screen summary totals (computeUserTotals) are computed
client-side from one month fetch. The hook requested limit=1000 but
parsePagination silently clamped it to 100, so once a month exceeded 100
attendance rows (~5 employees x 21 shifts) the newest-first list dropped the
EARLIEST days of the month — screen totals undercounted while the print path
(complete server fetch) stayed correct. This is the data-volume cliff that
made the summary counting look like it changed without any formula change:
git archaeology confirms every counting formula is bit-identical from v1.9.1
through HEAD.

- routes/admin/attendance.ts: list endpoint passes maxLimit 2000 to
  parsePagination (complete-month view; 2000 ~ 64 employees x 31 days)
- useAttendanceAdmin: month fetch requests limit=2000 with the constraint
  documented
- regression test: a 120-row month returns all 120 records

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
BOHA
2026-06-10 10:20:40 +02:00
parent 1826fc7976
commit b3e2abf9b2
3 changed files with 48 additions and 2 deletions

View File

@@ -219,7 +219,14 @@ export default async function attendanceRoutes(
}
// --- Default: paginated records list ---
const { page, limit, skip, order } = parsePagination(query);
// maxLimit must allow a COMPLETE month: the admin month view fetches all
// records at once and computes the KPI cards / summary totals client-side
// (useAttendanceAdmin). With the default 100-row cap, months with more
// than 100 records were silently truncated (newest-first), so the screen
// totals dropped the earliest days while the print stayed complete.
const { page, limit, skip, order } = parsePagination(query, {
maxLimit: 2000,
});
const isAdmin = authData.permissions.includes("attendance.manage");
const parsedUserId = query.user_id ? Number(query.user_id) : undefined;
const userId =