From adc9e6451b15c945a43edda96a1983e44439d841 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IT=E7=8B=97?= Date: Tue, 21 Jul 2026 12:08:31 +0800 Subject: [PATCH] Fix: show attendance status for employees who worked on holiday (not just holiday name) --- backend/main.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/backend/main.py b/backend/main.py index 2952620..2bd4348 100644 --- a/backend/main.py +++ b/backend/main.py @@ -128,9 +128,19 @@ def enrich_attendance_with_leave(records, db): if r.date in holidays_by_date: h = holidays_by_date[r.date] - r.status_code = "holiday" - r.status_text = f"\U0001F3D6\uFE0F{h.name}" - continue + # 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_text = f"\U0001F3D6\uFE0F{h.name}" + 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, []) if not emp_leaves: