revert: month Excel FPD column counts N/O as 0 h again
The Excel FPD column is meant to differ from the web FPD check; only O should behave like N, which it already did. Keeps the D-like colour for O. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -434,7 +434,7 @@ def main():
|
|||||||
continue
|
continue
|
||||||
worked = 0.0
|
worked = 0.0
|
||||||
vacation = 0.0 # D = 8h, D/2 = 4h — reduces person's FPD target
|
vacation = 0.0 # D = 8h, D/2 = 4h — reduces person's FPD target
|
||||||
def collect(v, is_workday):
|
def collect(v):
|
||||||
nonlocal worked, vacation
|
nonlocal worked, vacation
|
||||||
if not v:
|
if not v:
|
||||||
return
|
return
|
||||||
@@ -442,12 +442,9 @@ def main():
|
|||||||
vacation += 8
|
vacation += 8
|
||||||
elif v == 'D/2':
|
elif v == 'D/2':
|
||||||
vacation += 4
|
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:
|
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)
|
worked += hours_for(v)
|
||||||
for d in schedule['dayIndex']:
|
for d in schedule['dayIndex']:
|
||||||
if d['year'] != year or d['month'] != month:
|
if d['year'] != year or d['month'] != month:
|
||||||
@@ -455,14 +452,13 @@ def main():
|
|||||||
cd = person['data'].get(str(d['idx']))
|
cd = person['data'].get(str(d['idx']))
|
||||||
if not cd:
|
if not cd:
|
||||||
continue
|
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')
|
is_split = bool(cd.get('dayColor') or cd.get('nightColor')
|
||||||
or cd.get('dayValue') or cd.get('nightValue'))
|
or cd.get('dayValue') or cd.get('nightValue'))
|
||||||
if is_split:
|
if is_split:
|
||||||
collect(cd.get('dayValue'), is_workday)
|
collect(cd.get('dayValue'))
|
||||||
collect(cd.get('nightValue'), is_workday)
|
collect(cd.get('nightValue'))
|
||||||
else:
|
else:
|
||||||
collect(cd.get('v'), is_workday)
|
collect(cd.get('v'))
|
||||||
person_fpd = month_fpd - vacation
|
person_fpd = month_fpd - vacation
|
||||||
diff = worked - person_fpd
|
diff = worked - person_fpd
|
||||||
dst = ws.cell(row, 72)
|
dst = ws.cell(row, 72)
|
||||||
|
|||||||
Reference in New Issue
Block a user