Fix: show attendance status for employees who worked on holiday (not just holiday name)

This commit is contained in:
IT狗
2026-07-21 12:08:31 +08:00
parent a34905661b
commit adc9e6451b
+10
View File
@@ -128,9 +128,19 @@ def enrich_attendance_with_leave(records, db):
if r.date in holidays_by_date: if r.date in holidays_by_date:
h = holidays_by_date[r.date] h = holidays_by_date[r.date]
# Only mark as holiday if no clock-in record
# (employee who worked on holiday should keep attendance status)
has_clock_in = (
(r.check_in is not None) or
(r.actual_in and r.actual_in not in ("", "-"))
)
if not has_clock_in:
r.status_code = "holiday" r.status_code = "holiday"
r.status_text = f"\U0001F3D6\uFE0F{h.name}" r.status_text = f"\U0001F3D6\uFE0F{h.name}"
continue continue
# Has clock-in on holiday: keep computed attendance status but append holiday flag
base = r.status_text or "正常"
r.status_text = f"{base} (🎉{h.name})"
emp_leaves = leave_by_emp_date.get(r.employee_name, {}).get(r.date, []) emp_leaves = leave_by_emp_date.get(r.employee_name, {}).get(r.date, [])
if not emp_leaves: if not emp_leaves: