Skip to content

feat: 인메모리 Set으로 QR 중복 출석 방지 추가 - #9

Merged
ilcm96 merged 1 commit into
mainfrom
feat/qr-attendance-duplicate-feedback
May 23, 2026
Merged

feat: 인메모리 Set으로 QR 중복 출석 방지 추가#9
ilcm96 merged 1 commit into
mainfrom
feat/qr-attendance-duplicate-feedback

Conversation

@ilcm96

@ilcm96 ilcm96 commented May 23, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

릴리스 노트

  • New Features

    • QR 코드 중복 스캔 시 자동으로 감지하고 안내 메시지 표시
  • Bug Fixes

    • 출석 처리 실패 시 상태별 오류 메시지 개선 및 명확화

@ilcm96
ilcm96 requested a review from KwonDeaGeun May 23, 2026 11:57
@ilcm96 ilcm96 self-assigned this May 23, 2026
@coderabbitai

coderabbitai Bot commented May 23, 2026

Copy link
Copy Markdown

주요 변경사항

이 PR은 QR 코드 스캔 시 중복 출석 처리를 방지하는 기능을 추가합니다. 알림 유틸에 정보 메시지 표시 함수를 추가하고, 스캐너 컴포넌트에서 이미 처리된 회원을 추적하여 중복 등록을 방지합니다.

변경사항

QR 스캔 중복 방지

레이어 / 파일 요약
알림 유틸 - 정보 알림 지원
src/utils/alert.tsx
showInfo 함수가 추가되어 toast.info를 사용한 2500ms 지속시간의 정보 메시지 표시 기능을 제공합니다.
QR 스캐너 - 중복 처리 방지
src/components/QRScanner.tsx
처리된 회원 ID를 Set으로 추적하고, 스캔 결과에서 중복 여부를 확인합니다. 중복인 경우 정보 메시지를 표시하고, 출석 제출 성공/실패 시 처리 상태를 관리하며 에러 메시지를 상태 코드별로 다르게 표시합니다.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목이 변경사항의 핵심을 명확하게 요약하고 있습니다. 인메모리 Set을 사용한 QR 중복 출석 방지라는 주요 기능이 직관적으로 표현되어 있습니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/components/QRScanner.tsx (1)

29-29: ⚡ Quick win

QR 스캐너 닫았다 열면 processedMemberIdsRef(중복 방지 Set) 리셋되는 동작 확인

processedMemberIdsRefQRScanner 컴포넌트 내부 useRef 상태라, 다이얼로그가 닫혀 QRScannerComponent가 언마운트되면 초기화됩니다.
현재 QRScanneronClose(닫기 버튼/세션 만료)가 상위 handleCloseQR로 전달되고, handleCloseQR에서 setQrActivityId(null)(URL의 id 파라미터 삭제)이 호출되면서 qrActivityId !== null 조건부 렌더가 해제되어 언마운트가 일어납니다.

이 “닫았다가 다시 열면 이전에 처리된 memberId 기록이 사라짐”이 의도된 것인지 확인해 주세요.

  • 의도된 경우: 세션 단위로 중복 방지를 새로 시작하는 설계로 적절함
  • 의도되지 않은 경우: Set을 상위(페이지/세션) 상태로 끌어올려 닫기 전후에 유지되도록 조정 필요
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/QRScanner.tsx` at line 29, QRScanner 내부의 useRef 변수
processedMemberIdsRef가 컴포넌트 언마운트 시 리셋되어 "닫았다 열면 중복 방지 기록이 사라지는" 동작이 발생합니다; 의도하지
않았다면 processedMemberIdsRef를 상위 상태로 끌어올려 유지해야 합니다. 구체적으로는
QRScannerComponent/QRScanner에서 사용하던 processedMemberIdsRef를 상위 컴포넌트(페이지)로 올리고
useState 또는 useRef로 관리한 뒤 해당 상태(예: processedMemberIds)를 QRScanner에 props로 전달하고,
QRScanner 내에서 기존 processedMemberIdsRef 대신 전달된 props(예: processedMemberIds,
setProcessedMemberIds 또는 addProcessedMember 함수)를 사용하도록 변경하세요; 반대로 의도된 동작이면 아무
변경하지 말고 onClose → handleCloseQR → setQrActivityId(null) 흐름을 그대로 유지하십시오 (참조 심볼:
processedMemberIdsRef, QRScanner/QRScannerComponent, onClose, handleCloseQR,
setQrActivityId).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/components/QRScanner.tsx`:
- Line 29: QRScanner 내부의 useRef 변수 processedMemberIdsRef가 컴포넌트 언마운트 시 리셋되어 "닫았다
열면 중복 방지 기록이 사라지는" 동작이 발생합니다; 의도하지 않았다면 processedMemberIdsRef를 상위 상태로 끌어올려 유지해야
합니다. 구체적으로는 QRScannerComponent/QRScanner에서 사용하던 processedMemberIdsRef를 상위
컴포넌트(페이지)로 올리고 useState 또는 useRef로 관리한 뒤 해당 상태(예: processedMemberIds)를
QRScanner에 props로 전달하고, QRScanner 내에서 기존 processedMemberIdsRef 대신 전달된 props(예:
processedMemberIds, setProcessedMemberIds 또는 addProcessedMember 함수)를 사용하도록
변경하세요; 반대로 의도된 동작이면 아무 변경하지 말고 onClose → handleCloseQR → setQrActivityId(null)
흐름을 그대로 유지하십시오 (참조 심볼: processedMemberIdsRef, QRScanner/QRScannerComponent,
onClose, handleCloseQR, setQrActivityId).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: eb651c21-509e-4f61-87a8-54ebcfa4c491

📥 Commits

Reviewing files that changed from the base of the PR and between cf19280 and d8a6816.

📒 Files selected for processing (2)
  • src/components/QRScanner.tsx
  • src/utils/alert.tsx

@KwonDeaGeun KwonDeaGeun left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!
Id 저장을 Set으로 한 것도 좋고, useRef도 적절하다고 생각합니다.

@ilcm96
ilcm96 merged commit 2115394 into main May 23, 2026
2 checks passed
@ilcm96
ilcm96 deleted the feat/qr-attendance-duplicate-feedback branch May 23, 2026 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants