From 4bd6d0e7c809a2b73b17ab1ec58680fbb38bdbab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IT=E7=8B=97?= Date: Tue, 21 Jul 2026 22:13:12 +0800 Subject: [PATCH] =?UTF-8?q?StatusBadge:=20fix=20normal=20badge=20=E2=80=94?= =?UTF-8?q?=20only=20check=20status=5Fcode,=20not=20text?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous condition 'c === "normal" && !t' required status_text to be empty, but enriched records carry text suffixes like '正常 + CL4h' which are truthy and dropped normal records into the '異常' fallback. 3 Kaka records (id=22/28/30) were affected — act_in 10:38/10:43 (early), act_out 20:00 (on time), so they should render the green '正常' badge but were showing '異常' instead. --- frontend/src/components/StatusBadge.jsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/StatusBadge.jsx b/frontend/src/components/StatusBadge.jsx index 77cfcbf..6b2ca90 100644 --- a/frontend/src/components/StatusBadge.jsx +++ b/frontend/src/components/StatusBadge.jsx @@ -48,8 +48,9 @@ export default function StatusBadge({ code = '', text = '', size = 'sm' }) { return badge(, '請假', 'bg-violet-100 text-violet-700') } - // 正常 - if (c === 'normal' && !t) { + // 正常 (only when status_code is 'normal' — text suffix like '+ CL4h' is allowed, + // we still want to flag it as 正常 first since the employee did clock in/out normally) + if (c === 'normal') { return badge(, '正常', 'bg-green-100 text-green-700') }