Fix: show attendance status for employees who worked on holiday (not just holiday name)
This commit is contained in:
+13
-3
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user