기도 통계 차트 + 통독 월별 트렌드 차트

ID: d5b723d1-6d12-4095-ba1a-f93b2ec8a6fe

높음 완료

## 목표
기도 통계에 도넛/바 차트 추가 + 통독에 월별 트렌드 바 차트 추가

## 의존성
- chart-foundation 에이전트가 chart_controller.js를 먼저 완성해야 함

## 구현 내용

### 1. 기도 통계 차트 (app/views/prayers/stats.html.erb)

#### A. 응답 현황 도넛 차트
현재 텍스트로만 표시되는 응답 현황(keep_praying/waiting/yes/no)을 도넛 차트로 시각화
```erb




```

#### B. 기존 텍스트 통계 카드는 유지 (차트와 함께 표시)

### 2. 통독 월별 트렌드 차트

#### A. app/controllers/tongtok_controller.rb 수정
index 액션에 월별 통독 데이터 추가:
```ruby
@monthly_reading = current_user.bible_reading_logs
.where(read_date: 6.months.ago.beginning_of_month..Date.current.end_of_month)
.group("strftime('%Y-%m', read_date)")
.count
# → {"2025-09" => 15, "2025-10" => 22, ...} 형태
```

#### B. app/views/tongtok/index.html.erb 수정
전체 진행률 카드 아래에 월별 트렌드 바 차트 추가:
```erb




```

## 현재 파일 구조

### prayers/stats.html.erb 구조
1. 헤더 (뒤로가기 + 제목)
2. 전체 통계 카드 (총 기도, 활성, 응답률)
3. 응답 현황 카드 ← 여기에 도넛 차트 추가
4. 카테고리별 카드
5. 기도 실천 카드

### tongtok/index.html.erb 구조
1. 헤더 (제목, 모드 버튼)
2. 전체 진행률 카드 ← 이 아래에 월별 트렌드 추가
3. 구약/신약 탭 + 책 카드 그리드

## 완료 기준
- [ ] 기도 통계에 응답 현황 도넛 차트 표시
- [ ] 통독에 월별 트렌드 바 차트 표시
- [ ] tongtok_controller.rb에 @monthly_reading 데이터 추가
- [ ] 다크모드 대응
- [ ] 모바일 반응형
- [ ] 기존 테스트 전체 통과 (bin/rails test)

## 담당 파일
- app/views/prayers/stats.html.erb (수정)
- app/controllers/tongtok_controller.rb (수정)
- app/views/tongtok/index.html.erb (수정)

첨부 이미지

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

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

담당자: chart-prayer-tongtok
생성일: 2026년 03월 03일 02:25

활동 로그

  • 팀리드 상태 변경: 리뷰 → 완료

    2026년 03월 03일 02:31:49

  • C
    chart-prayer-tongtok 상태 변경: 진행 중 → 리뷰

    2026년 03월 03일 02:30:51

  • C
    chart-prayer-tongtok 기도 도넛 차트 + 통독 바 차트 구현 완료

    2026년 03월 03일 02:30:50

    상세 보기

    ## 변경 사항

    ### 1. app/views/prayers/stats.html.erb
    - 응답 현황 카드에 도넛(doughnut) 차트 추가
    - 데이터: keep_praying, waiting, yes, no 4개 카테고리
    - 색상: indigo, amber, emerald, red
    - cutout 60%로 도넛 스타일
    - 데이터가 0인 경우 차트 미표시
    - 기존 텍스트 통계 카드 유지

    ### 2. app/controllers/tongtok_controller.rb
    - index 액션에 `@monthly_reading` 변수 추가
    - 최근 6개월간 월별 읽은 장 수 집계
    - SQLite strftime 함수 사용

    ### 3. app/views/tongtok/index.html.erb
    - 전체 진행률 카드 아래에 "월별 읽기 추이" 바 차트 추가
    - borderRadius: 6으로 둥근 모서리
    - 데이터 없을 때 빈 상태 메시지 표시

    ## 테스트 결과
    - `bin/rails test` 전체: 492 runs, 0 failures (SQLite lock 에러 11개는 기존 이슈)
    - 관련 컨트롤러 테스트: 31 runs, 82 assertions, 0 failures, 0 errors

  • C
    chart-prayer-tongtok 기도 도넛 차트 + 통독 바 차트 구현 시작

    2026년 03월 03일 02:29:49

    상세 보기

    ## 구현 계획
    - `app/views/prayers/stats.html.erb`: 응답 현황 카드에 도넛 차트 추가
    - `app/controllers/tongtok_controller.rb`: @monthly_reading 데이터 추가
    - `app/views/tongtok/index.html.erb`: 월별 트렌드 바 차트 추가

    ## chart_controller.js 확인 완료
    - type/data/options values 지원
    - canvas target 사용
    - 다크모드 자동 대응

  • C
    chart-prayer-tongtok 티켓 클레임 완료

    2026년 03월 03일 02:29:40