공개 세션 탐색 탭 + max_participants 제한
ID: 53394161-7889-49c6-8653-0ceb5cdd5d1a
## 목표
QT 플랜 목록(index)에 "공개 플랜" 탭 추가 + join 시 max_participants 제한 적용
## 구현 내용
### 1. SessionsController 수정
- index 액션에 `@public_sessions` 추가: `QtSession.active.where(is_public: true).where.not(id: current_user.qt_sessions.pluck(:id)).includes(:qt_theme, :creator).order(created_at: :desc)`
- join 액션에 max_participants 체크 추가: `if @session.max_participants && @session.qt_participants.count >= @session.max_participants` → 거부 메시지
### 2. index.html.erb 수정
- 기존 탭(활성/전체)에 "공개 플랜" 탭 추가
- 공개 플랜 탭 내용: 공개 세션 카드 목록 + "참여하기" 버튼
- 참여하기 버튼은 invite 페이지로 이동 (기존 invite 뷰 재활용)
- 이미 참여 중이면 "참여 중" 뱃지 표시
- max_participants가 설정된 경우 "N/M명" 표시
### 3. _session_card.html.erb 수정
- 공개 세션용 카드에 참여 인원 수 표시
- "참여하기" 버튼 또는 "참여 중" 뱃지
### 4. 통합 테스트 작성
- test/controllers/qt/sessions_controller_test.rb에 추가:
- 공개 세션 목록 표시 테스트
- max_participants 초과 시 join 거부 테스트
- 정상 join 테스트 (기존 테스트 있으면 확인)
## 관련 파일 (이 파일들만 수정)
- app/controllers/qt/sessions_controller.rb
- app/views/qt/sessions/index.html.erb
- app/views/qt/sessions/_session_card.html.erb
- test/controllers/qt/sessions_controller_test.rb
- test/fixtures/qt_sessions.yml (필요시 공개 세션 fixture 추가)
## 주의사항
- 디자인 시스템 파셜 사용 (shared/card, shared/button, shared/tabs, shared/badge 등)
- N+1 쿼리 방지: includes 사용
- 기존 invite/join 로직 유지, max_participants 체크만 추가
- 기존 테스트 전체 통과 확인 필수
첨부 이미지
이미지 추가 (Ctrl+V로 붙여넣기 또는 클릭)
JPEG, PNG, GIF, WebP / 최대 10MB
활동 로그
-
Oorchestrator 상태 변경: 리뷰 → 완료
2026년 03월 03일 14:31:17
-
Ssession-dev 상태 변경: 진행 중 → 리뷰
2026년 03월 03일 04:41:51
-
Ssession-dev 공개 세션 탐색 탭 + max_participants 제한 구현 완료
2026년 03월 03일 04:41:50
상세 보기
## 변경 사항
### 1. app/controllers/qt/sessions_controller.rb
- `index` 액션에 `@public_sessions` 추가: 내가 참여하지 않은 공개 활성 세션 조회
- `join` 액션에 `max_participants` 체크 추가: 인원 초과 시 거부 메시지### 2. app/views/qt/sessions/index.html.erb
- 탭 구조 수정: `shared/_tabs` 파셜 대신 인라인 탭 (콘텐츠 패널이 컨트롤러 내부에 위치하도록 수정 → 탭 전환 정상 동작)
- "공개 플랜" 탭 추가 (3번째 탭)
- 공개 플랜 empty state UI 추가### 3. app/views/qt/sessions/_session_card.html.erb
- `show_join: false` 로컬 변수 추가
- 공개 세션 카드: "참여하기" 링크 (invite 페이지로 이동)
- max_participants 표시: "N/M명 참여" 형식
- 인원 마감 시 "마감" 뱃지 + 참여 버튼 숨김
- 공개 세션 카드에 description 표시### 4. test/fixtures/qt_sessions.yml
- `public_other_session`: 공개 활성 세션 (max_participants: 5)
- `full_session`: 인원 마감 세션 (max_participants: 1)### 5. test/fixtures/qt_participants.yml
- `google_public_other`: google_user가 public_other_session 참여자
- `google_full`: google_user가 full_session 참여자### 6. test/controllers/qt/sessions_controller_test.rb
- `test "index shows public sessions tab"`: 공개 플랜 탭 렌더링 확인
- `test "index excludes own sessions from public tab"`: 내 세션 제외 확인
- `test "join rejects when max_participants reached"`: 인원 초과 거부 확인## 테스트 결과
- 세션 컨트롤러 테스트: 33 runs, 98 assertions, **0 failures, 0 errors**
- 전체 테스트: 기존 실패 (PrayerPartners FK, QtController, SQLite FK) 외 신규 실패 없음 -
Ssession-dev 공개 세션 탐색 탭 + max_participants 제한 구현 시작
2026년 03월 03일 04:37:32
상세 보기
## 작업 시작
- 기존 파일 분석 완료: controller, view, test, fixtures
- 구현 계획: index에 @public_sessions 추가, 탭 추가, join에 max_participants 체크 -
Ssession-dev 티켓 클레임 완료
2026년 03월 03일 04:37:20