From 0c0771a30d04a27143d28ab013769cc4d9d1d022 Mon Sep 17 00:00:00 2001 From: sangkyu Date: Sat, 7 Mar 2026 21:08:32 +0900 Subject: [PATCH 1/2] =?UTF-8?q?[FE]=20=EC=B6=9C=EC=84=9D=EC=A1=B0=ED=9A=8C?= =?UTF-8?q?=20=EC=84=B8=EC=85=98=20=EC=84=A0=ED=83=9D=20=EC=A0=84=20?= =?UTF-8?q?=EC=A4=91=EB=B3=B5=20=EB=B0=9C=EC=83=9D=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/attendance/SessionManage.jsx | 18 +++++++++--- .../attendance/SessionSelectBox.jsx | 12 +++++--- frontend/src/pages/Attendance.jsx | 28 +++++++++++++++++-- 3 files changed, 48 insertions(+), 10 deletions(-) diff --git a/frontend/src/components/attendance/SessionManage.jsx b/frontend/src/components/attendance/SessionManage.jsx index 55eb009a..fe0ba42c 100644 --- a/frontend/src/components/attendance/SessionManage.jsx +++ b/frontend/src/components/attendance/SessionManage.jsx @@ -2,6 +2,9 @@ import { useMemo } from 'react'; import styles from './SessionManage.module.css'; import { ClipboardCheck } from 'lucide-react'; +const normalizeSessionTitle = (sessionTitle) => + typeof sessionTitle === 'string' && sessionTitle.trim() !== '' ? sessionTitle.trim() : '기타'; + const getRoundKey = (session) => session.roundId || `${session.roundDate || ''}-${session.roundStartAt || ''}`; const getTimestamp = (session) => { @@ -44,7 +47,7 @@ const SessionManage = ({ sessions = [], selectedSession = '', loading, error }) const roundIndexMapBySession = useMemo(() => { const roundMapBySession = new Map(); sessions.forEach((session) => { - const sessionTitle = session.sessionTitle || '기타'; + const sessionTitle = normalizeSessionTitle(session.sessionTitle); if (!roundMapBySession.has(sessionTitle)) { roundMapBySession.set(sessionTitle, new Map()); } @@ -75,11 +78,18 @@ const SessionManage = ({ sessions = [], selectedSession = '', loading, error }) }, [sessions]); const visibleSessions = useMemo(() => { + const selectedSessionTitle = normalizeSessionTitle(selectedSession); + const filtered = selectedSession - ? sessions.filter((session) => session.sessionTitle === selectedSession) + ? sessions.filter((session) => normalizeSessionTitle(session.sessionTitle) === selectedSessionTitle) : sessions; - return [...filtered].sort((a, b) => getTimestamp(a) - getTimestamp(b)); + const deduplicated = filtered.filter((session, index, array) => { + if (!session?.attendanceId) return true; + return array.findIndex((item) => item?.attendanceId === session.attendanceId) === index; + }); + + return [...deduplicated].sort((a, b) => getTimestamp(a) - getTimestamp(b)); }, [sessions, selectedSession]); if (error) return
{error}
; @@ -106,7 +116,7 @@ const SessionManage = ({ sessions = [], selectedSession = '', loading, error }) {rows.map((s) => { - const sessionTitle = s.sessionTitle || '기타'; + const sessionTitle = normalizeSessionTitle(s.sessionTitle); const roundKey = getRoundKey(s); const roundIndex = roundIndexMapBySession.get(sessionTitle)?.get(roundKey) ?? '-'; diff --git a/frontend/src/components/attendance/SessionSelectBox.jsx b/frontend/src/components/attendance/SessionSelectBox.jsx index 0dbb5693..1f221c07 100644 --- a/frontend/src/components/attendance/SessionSelectBox.jsx +++ b/frontend/src/components/attendance/SessionSelectBox.jsx @@ -1,6 +1,9 @@ import styles from './SessionSelectBox.module.css'; import { ClipboardCheck } from 'lucide-react'; +const normalizeSessionTitle = (sessionTitle) => + typeof sessionTitle === 'string' ? sessionTitle.trim() : ''; + const SessionSelectBox = ({ sessions = [], selectedSession = '', @@ -10,11 +13,13 @@ const SessionSelectBox = ({ const sessionList = Array.from( new Set( sessions - .map((session) => session.sessionTitle) - .filter((sessionTitle) => typeof sessionTitle === 'string' && sessionTitle.trim() !== ''), + .map((session) => normalizeSessionTitle(session.sessionTitle)) + .filter((sessionTitle) => sessionTitle !== ''), ), ); + const currentValue = sessionList.includes(selectedSession) ? selectedSession : sessionList[0] || ''; + return (
@@ -24,11 +29,10 @@ const SessionSelectBox = ({