EngagementSurveyResponsesController 공개 응답 플로우 구현

ID: f76cda8a-44f3-430a-8f65-3f28480e571f

높음 할 일

## 작업: 비인증 설문 응답 컨트롤러 + 뷰

### 참조 (반드시 읽기)
- `.claude/skills/rails-core/SKILL.md`
- `.claude/skills/rails-testing/SKILL.md`
- `.claude/skills/hotwire-patterns/SKILL.md` — Turbo Streams 문항 전환
- `.claude/skills/ui-design/SKILL.md` — 디자인 시스템
- 기존 진단 플로우 참고: `app/controllers/diagnosis_sessions_controller.rb`
- 기존 뷰 패턴: `app/views/diagnosis_sessions/engagement_show.html.erb`, `_engagement_question.html.erb`, `_engagement_guide.html.erb`
- PR2 서비스: `app/services/engagement_surveys/submit_response_service.rb`
- 문항 데이터: `db/seeds/engagement/engagement_questions_b2b.csv`
- QR 헬퍼: `app/helpers/qr_code_helper.rb`

### 컨트롤러: `app/controllers/engagement_survey_responses_controller.rb`

```ruby
class EngagementSurveyResponsesController < ApplicationController
allow_unauthenticated_access
layout "focus" # 또는 기존 진단 플로우에서 사용하는 레이아웃 확인
end
```

#### 라우트 (`config/routes.rb`에 추가, workspaces 밖)
```ruby
scope "engage/:access_token", controller: "engagement_survey_responses" do
get "/", action: :show, as: :engagement_survey_response
post "start", action: :start, as: :start_engagement_survey
post "submit", action: :submit, as: :submit_engagement_survey
get "complete", action: :complete, as: :complete_engagement_survey
end
```

#### 액션
- **show** (GET `/engage/:access_token`):
- access_token으로 survey 조회, active 상태 확인
- 워크스페이스의 그룹 목록 표시
- 그룹 선택 UI

- **start** (POST):
- 그룹 선택 확인
- 안내 메시지 표시:
- "약 5분이 소요됩니다"
- "3명 이하 그룹의 결과는 측정되지 않습니다"
- "응답자의 정보는 기록되지 않습니다"
- 세션에 그룹 ID 저장
- 문항 페이지로 이동

- **submit** (POST):
- 10문항 7점 척도 응답 수집
- EngagementSurveys::SubmitResponseService 호출
- user: Current.user (로그인 시 참고용, nil도 OK)
- complete로 redirect

- **complete** (GET):
- 감사 메시지 + 브라우저 닫기 안내

#### 뷰 파일 (실제 구현)
- `app/views/engagement_survey_responses/show.html.erb` — 그룹 선택
- `app/views/engagement_survey_responses/start.html.erb` — 안내 + 문항 시작
- `app/views/engagement_survey_responses/submit.html.erb` — 10문항 7점 척도 (기존 _engagement_question 패턴 참고)
- 또는 start 뷰에서 문항까지 한 페이지로 처리 (기존 engagement_show 패턴 확인)
- `app/views/engagement_survey_responses/complete.html.erb` — 완료

### B2B 10문항 데이터
```
1. belonging / psychological_safety / "팀에서 소속감을 느꼈다"
2. autonomy / psychological_safety / "업무 방식을 스스로 결정할 수 있었다"
3. meaning / psychological_safety / "내 업무가 의미 있다고 느꼈다"
4. recognition / self_efficacy / "나의 기여를 인정받았다"
5. achievement / self_efficacy / "업무 목표를 달성하고 있다고 느꼈다"
6. growth / self_efficacy / "업무를 통해 성장하고 있다고 느꼈다"
7. vitality / flow_experience / "일할 때 활력이 넘쳤다"
8. strength_use / flow_experience / "업무에서 나의 강점을 발휘했다"
9. positive_affect / flow_experience / "일하면서 긍정적인 감정을 느꼔다"
10. overall / overall / "현재 나의 직장에 만족한다"
```
- 문항은 DB(SurveyQuestion)에서 가져오거나, 하드코딩 (question_type="engagement_b2b")

### 테스트: `test/controllers/engagement_survey_responses_controller_test.rb`
- show: access_token으로 접근 가능
- show: 비활성 설문 접근 차단
- start: 그룹 선택 후 안내 표시
- submit: 10문항 응답 제출 성공
- complete: 완료 페이지 렌더링
- 비인증 접근 가능 확인

### 주의사항
- **파일 충돌 방지**: developer-1이 `workspaces/engagement_surveys_controller.rb`와 라우트를 수정하므로, 이 에이전트는 `engagement_survey_responses_controller.rb`만 생성
- 라우트 추가 시 developer-1과 겹치지 않는 위치에 추가 (workspaces 블록 밖)
- 모바일 최적화 (QR 스캔이 주 진입점)
- 모든 rails 명령: `docker compose exec web`

첨부 이미지

이미지 추가 (Ctrl+V로 붙여넣기 또는 클릭)

JPEG, PNG, GIF, WebP / 최대 10MB

담당자: developer-2
생성일: 2026년 03월 17일 08:23

활동 로그

아직 활동 기록이 없습니다.