feat: month Excel FPD column matches the web FPD check for N and O
Restores the rule from707e18c: a working-day N or O is credited as a worked day (8 h) in the FPD column of the Excel exported by the "Excel" button, the same as the web FPD check. Revertse2da33b. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -434,7 +434,7 @@ def main():
|
||||
continue
|
||||
worked = 0.0
|
||||
vacation = 0.0 # D = 8h, D/2 = 4h — reduces person's FPD target
|
||||
def collect(v):
|
||||
def collect(v, is_workday):
|
||||
nonlocal worked, vacation
|
||||
if not v:
|
||||
return
|
||||
@@ -442,9 +442,12 @@ def main():
|
||||
vacation += 8
|
||||
elif v == 'D/2':
|
||||
vacation += 4
|
||||
elif v in ('N', 'O'):
|
||||
# sick / paternity leave on a working day is credited as a normal
|
||||
# worked day, so it neither helps nor hurts the balance (as in FpdCheck.tsx)
|
||||
if is_workday:
|
||||
worked += 8
|
||||
else:
|
||||
# N and O (like U, x) count as 0 hours here — intentionally different
|
||||
# from the web FPD check, which credits them as a worked day.
|
||||
worked += hours_for(v)
|
||||
for d in schedule['dayIndex']:
|
||||
if d['year'] != year or d['month'] != month:
|
||||
@@ -452,13 +455,14 @@ def main():
|
||||
cd = person['data'].get(str(d['idx']))
|
||||
if not cd:
|
||||
continue
|
||||
is_workday = not d.get('weekend') and (d['month'], d['day']) not in holidays
|
||||
is_split = bool(cd.get('dayColor') or cd.get('nightColor')
|
||||
or cd.get('dayValue') or cd.get('nightValue'))
|
||||
if is_split:
|
||||
collect(cd.get('dayValue'))
|
||||
collect(cd.get('nightValue'))
|
||||
collect(cd.get('dayValue'), is_workday)
|
||||
collect(cd.get('nightValue'), is_workday)
|
||||
else:
|
||||
collect(cd.get('v'))
|
||||
collect(cd.get('v'), is_workday)
|
||||
person_fpd = month_fpd - vacation
|
||||
diff = worked - person_fpd
|
||||
dst = ws.cell(row, 72)
|
||||
|
||||
Reference in New Issue
Block a user