Attendance filter: 請假/公假 — also match leave/holiday suffix in status_text
Pure-leave status_code (al/sl/cl/mixed_leave) only catches employees who took the whole day off. Records where the employee worked AND took leave mid-day keep their raw status_code (normal/abnormal/ot) but carry a ' + SL2h' / ' + AL4h' suffix that the badge now surfaces as a chip — yet those records disappeared under the '請假' filter. Same gap for holidays: '公假' only matched status_code='holiday' but an employee who worked on the public holiday still gets the '🎉' suffix and should be reachable from the holiday filter. Expand both filters to also match records whose status_text contains the relevant suffix (' + SL' / ' + AL' / ' + CL' / '🎉'), keeping the result set aligned with what the badge chip advertises.
This commit is contained in:
+12
-2
@@ -1318,11 +1318,21 @@ async def attendance_records(
|
|||||||
elif status_text in ('missing', '缺勤'):
|
elif status_text in ('missing', '缺勤'):
|
||||||
rows = [r for r in all_rows if (r.status_code or '').lower() == 'missing']
|
rows = [r for r in all_rows if (r.status_code or '').lower() == 'missing']
|
||||||
elif status_text in ('holiday', '公假'):
|
elif status_text in ('holiday', '公假'):
|
||||||
rows = [r for r in all_rows if (r.status_code or '').lower() == 'holiday']
|
# Holiday shift OR raw records carrying a holiday suffix in status_text
|
||||||
|
# (e.g. '異常 (🎉香港特區成立紀念日)' where the employee worked on the holiday).
|
||||||
|
rows = [r for r in all_rows
|
||||||
|
if (r.status_code or '').lower() == 'holiday'
|
||||||
|
or '🎉' in (r.status_text or '')]
|
||||||
elif status_text in leave_codes:
|
elif status_text in leave_codes:
|
||||||
rows = [r for r in all_rows if (r.status_code or '').lower() == status_text]
|
rows = [r for r in all_rows if (r.status_code or '').lower() == status_text]
|
||||||
elif status_text in ('leave', '請假'):
|
elif status_text in ('leave', '請假'):
|
||||||
rows = [r for r in all_rows if (r.status_code or '').lower() in leave_codes]
|
# Any leave presence: pure leave status_code OR a leave suffix appended
|
||||||
|
# to a normal/abnormal/ot code (employee worked but took leave mid-day).
|
||||||
|
# Suffix format produced by enrich: ' + SL2h', ' + AL4h', ' + CL4h', etc.
|
||||||
|
rows = [r for r in all_rows
|
||||||
|
if (r.status_code or '').lower() in leave_codes
|
||||||
|
or any(f'+ {tag}' in (r.status_text or '')
|
||||||
|
for tag in ('SL', 'AL', 'CL'))]
|
||||||
elif status_text in ('normal', '正常'):
|
elif status_text in ('normal', '正常'):
|
||||||
rows = [r for r in all_rows if (r.status_code or '').lower() == 'normal']
|
rows = [r for r in all_rows if (r.status_code or '').lower() == 'normal']
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user