From 1e7d58486bf0a095da30ea63577a50a3fa34eac6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IT=E7=8B=97?= Date: Tue, 21 Jul 2026 12:35:16 +0800 Subject: [PATCH] Fix: prevent leave type duplication in status_text for attendance records --- backend/main.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/backend/main.py b/backend/main.py index 07e2f3a..72123df 100644 --- a/backend/main.py +++ b/backend/main.py @@ -180,6 +180,13 @@ def enrich_attendance_with_leave(records, db): else: r.status_code = "mixed_leave" r.status_text = leave_text + elif original_code in ("al", "sl", "cl"): + # Pure leave status: check if multiple leave types → upgrade to mixed + if len(leave_by_type) > 1: + r.status_code = "mixed_leave" + r.status_text = leave_text + else: + r.status_text = leave_text else: base = r.status_text or "正常" r.status_text = f"{base} + {leave_text}"