fix: negative PMS (práce mimo směnu) hours count in FPD totals

Web FPD check: PMS hours keep their sign (getPmsHours) instead of being
dropped when negative. Month Excel FPD column: PMS was not counted at
all; it now adds the signed PMS hours like the web.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Docker Config Backup
2026-09-30 08:52:13 +02:00
parent c220956146
commit 06a7e65340
2 changed files with 23 additions and 1 deletions

View File

@@ -87,6 +87,17 @@ def czech_holidays(year):
return out
def pms_hours(value):
"""PMS (práce mimo směnu) hours — like hours_for, but negative values keep
their sign (hours taken off). Matches getPmsHours in FpdCheck.tsx."""
if value in ('A', 'B'):
return 12
try:
return float(value)
except (ValueError, TypeError):
return 0
def hours_for(value):
"""Match webapp's getHoursForValue (FpdCheck.tsx):
A and B count as 12 hours; numeric values as themselves;
@@ -463,6 +474,10 @@ def main():
collect(cd.get('nightValue'), is_workday)
else:
collect(cd.get('v'), is_workday)
# PMS (práce mimo směnu) counts as worked hours, positive or negative (as in FpdCheck.tsx)
pms_v = (person['data'].get(str(-month)) or {}).get('v')
if pms_v:
worked += pms_hours(pms_v)
person_fpd = month_fpd - vacation
diff = worked - person_fpd
dst = ws.cell(row, 72)