fix: include holiday hours in covered time instead of subtracting from fund
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) <noreply@anthropic.com>
This commit is contained in:
@@ -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 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 covered = Math.round((worked + leaveHours) * 10) / 10;
|
||||||
const missing = Math.max(0, Math.round((userFund - covered) * 10) / 10);
|
const missing = Math.max(0, Math.round((userFund - covered) * 10) / 10);
|
||||||
const overtime = Math.max(0, Math.round((covered - userFund) * 10) / 10);
|
const overtime = Math.max(0, Math.round((covered - userFund) * 10) / 10);
|
||||||
|
|||||||
Reference in New Issue
Block a user