From bc2a14f637793b44c31a32bae2dd79956ad24a76 Mon Sep 17 00:00:00 2001 From: BOHA Date: Tue, 24 Mar 2026 19:18:26 +0100 Subject: [PATCH] fix: include holiday hours in covered time instead of subtracting from fund MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously: holidays reduced the fund (fund = bizDays - holidays). This caused a mismatch — frontend compared covered against full month fund, but backend used reduced fund. Now: holidays count as covered hours (like vacation/sick). Fund stays at full working days. So worked + vacation + sick + holidays = covered, and covered >= fund means fulfilled. Example: Jan has 22 days (176h), 1 holiday. Haas worked 168h. Before: fund=168, covered=168, OK but frontend saw fund=176, not OK. After: fund=176, covered=168+8=176, OK everywhere. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/services/attendance.service.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/services/attendance.service.ts b/src/services/attendance.service.ts index 0323081..a31d66f 100644 --- a/src/services/attendance.service.ts +++ b/src/services/attendance.service.ts @@ -406,9 +406,10 @@ export async function getWorkfund(year: number) { } } - const userFund = Math.max(0, (bizDaysToDate - holidayDays) * 8); + const userFund = bizDaysToDate * 8; const workedRound = Math.round(worked * 10) / 10; - const leaveHours = vacationHours + sickHours; + const holidayHours = holidayDays * 8; + const leaveHours = vacationHours + sickHours + holidayHours; const covered = Math.round((worked + leaveHours) * 10) / 10; const missing = Math.max(0, Math.round((userFund - covered) * 10) / 10); const overtime = Math.max(0, Math.round((covered - userFund) * 10) / 10);