Skip to content

20260526 #40 today stats 응답에 누적 통계 필드 3개 추가#41

Merged
EM-H20 merged 10 commits into
mainfrom
20260526_#40_today_stats_응답에_누적_통계_필드_3개_추가
May 27, 2026

Hidden character warning

The head ref may contain hidden characters: "20260526_#40_today_stats_\uc751\ub2f5\uc5d0_\ub204\uc801_\ud1b5\uacc4_\ud544\ub4dc_3\uac1c_\ucd94\uac00"
Merged

20260526 #40 today stats 응답에 누적 통계 필드 3개 추가#41
EM-H20 merged 10 commits into
mainfrom
20260526_#40_today_stats_응답에_누적_통계_필드_3개_추가

Conversation

@EM-H20

@EM-H20 EM-H20 commented May 26, 2026

Copy link
Copy Markdown
Contributor

✨ 변경 사항


✅ 테스트


  • 수동 테스트 완료
  • 테스트 코드 완료

Summary by CodeRabbit

릴리스 노트

  • New Features

    • 오늘의 공부 통계 응답에 누적 지표(평생 공부 시간, 평생 세션 수) 및 월간 공부 시간이 추가됩니다. 사용자는 일일 통계뿐 아니라 누적 학습 현황과 이번 달 진행도를 한눈에 확인할 수 있습니다.
  • Documentation

    • API 스펙 및 설계 문서가 업데이트되었습니다.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 26, 2026

Copy link
Copy Markdown

Walkthrough

GET /api/timer-sessions/today-stats 응답이 기존 3개 필드(오늘 총분, 세션수, 연속일수)에서 6개 필드로 확장되어 평생 누적 분/세션수와 이번 달 누적 분을 추가로 제공하도록 변경되었습니다. DTO, Repository 집계 메서드, Service 로직, 테스트, 문서가 함께 업데이트되었습니다.

Changes

Today Stats 누적 통계 응답 확장

Layer / File(s) Summary
응답 스키마 확장 및 문서
SS-Study/src/main/java/.../dto/TodayStatsResponse.java, SS-Web/src/main/java/.../controller/timer/TimerSessionController.java
TodayStatsResponse 레코드에 lifetimeMinutes, lifetimeSessionCount, monthlyMinutes 필드를 추가하고, Swagger @Operation/@ApiResponse를 6개 필드 및 KST 기준 집계 범위를 포함하도록 업데이트했습니다.
리포지토리 누적 집계 메서드
SS-Study/src/main/java/.../repository/TimerSessionRepository.java, SS-Study/src/test/java/.../repository/TimerSessionRepositoryTest.java
sumDurationByUserId, countByUserId 메서드를 Repository에 추가하여 사용자별 전체 누적 분/세션 수를 조회하고, 각각에 대한 통합 테스트(사용자별 필터링, 0건 반환 0)를 작성했습니다.
서비스 로직 확장 및 테스트
SS-Study/src/main/java/.../service/TimerSessionService.java, SS-Study/src/test/java/.../service/TimerSessionServiceTest.java
getTodayStats에서 KST 기준 월 시작/다음 달 시작을 UTC로 변환하여 monthlyMinutes를 계산하고, 새로운 Repository 메서드로 lifetimeMinutes/lifetimeSessionCount를 조회해 6개 필드를 모두 반환하도록 변경했습니다. Service 테스트를 확장하여 6개 필드 검증, 월 경계 매핑, null 방어, 혼합 월간 케이스를 검증하는 3개 신규 테스트를 추가했습니다.
컨트롤러 통합 테스트 및 응답 검증
SS-Web/src/test/java/.../controller/timer/TimerSessionControllerTest.java
기존 todayStats_200 테스트를 6개 필드 검증으로 확장하고, 0건 응답에서도 신규 필드들이 null 없이 숫자형 0으로 반환되는지 검증하는 todayStats_zero_neverNull 테스트를 추가했습니다.
API 명세 및 설계 문서 업데이트
docs/api-specs/03_timer.md, docs/superpowers/specs/2026-05-26-today-stats-cumulative-fields-design.md, docs/superpowers/plans/2026-05-26-today-stats-cumulative-fields.md
docs/api-specs/03_timer.md에서 today-stats 응답 필드를 6개로 확장하고 KST 시간 경계를 명시했습니다. 새로운 설계 문서에서 문제 정의, 응답 스키마, 구현 범위, 호환성, 테스트 계획, DOD를 정의했고, 구현 계획 문서에서 Task 1~6 단계의 세부 절차를 문서화했습니다.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

Possibly related PRs

  • SpaceStudyShip/SpaceStudyShip-BE#38: PR #38에서 도입한 TimerSession 도메인(TodayStatsResponse, TimerSessionRepository.sumDurationBetween/count, TimerSessionService.getTodayStats, 컨트롤러/테스트)의 동일한 today-stats 흐름을 확장하여 TodayStatsResponse/getTodayStats를 수정하고 lifetime+monthly 리포지토리 집계를 추가하는 것으로, DTO/서비스/리포지토리 코드 수준에서 직접 빌드-온 및 오버랩 관계임.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.52% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목은 주요 변경사항을 명확하게 요약하고 있습니다. 'today stats 응답에 누적 통계 필드 3개 추가'는 전체 changeset의 핵심을 정확히 반영합니다.
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.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 20260526_#40_today_stats_응답에_누적_통계_필드_3개_추가

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


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.

Actionable comments posted: 2

🤖 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.

Inline comments:
In `@docs/api-specs/03_timer.md`:
- Around line 250-252: Update the "오늘" time-bound description to use a half-open
interval consistent with "이번 달": replace "KST 00:00:00 ~ KST 23:59:59" with
"[KST 00:00:00, 다음날 KST 00:00:00)" so both "오늘" and "이번 달" use the same [start,
end) convention; ensure the heading "오늘" text is the only change and keep the
timezone labels (KST) intact.

In `@docs/superpowers/specs/2026-05-26-today-stats-cumulative-fields-design.md`:
- Around line 214-215: 문구 "기존 today/streak 테스트가 모두 통과해야 함 (수정 없이)"를 문서 전반의 관련
설명과 일치하도록 수정하세요; 구체적으로 해당 문구를 "기존 검증 의도는 유지하되, 시그니처/호출 변경에 따른 최소 테스트 보정 후 통과"로
바꿔서, 같은 PR에서 새 repository 호출로 인한 테스트 스텁/보정 필요성을 명확히 표시하고 실행자가 혼동하지 않도록 업데이트하세요.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1e9dc221-82bf-4b8f-bb9f-36a77b8532b0

📥 Commits

Reviewing files that changed from the base of the PR and between 7abcfc7 and c7d3098.

📒 Files selected for processing (10)
  • SS-Study/src/main/java/com/elipair/spacestudyship/study/timer/dto/TodayStatsResponse.java
  • SS-Study/src/main/java/com/elipair/spacestudyship/study/timer/repository/TimerSessionRepository.java
  • SS-Study/src/main/java/com/elipair/spacestudyship/study/timer/service/TimerSessionService.java
  • SS-Study/src/test/java/com/elipair/spacestudyship/study/timer/repository/TimerSessionRepositoryTest.java
  • SS-Study/src/test/java/com/elipair/spacestudyship/study/timer/service/TimerSessionServiceTest.java
  • SS-Web/src/main/java/com/elipair/spacestudyship/controller/timer/TimerSessionController.java
  • SS-Web/src/test/java/com/elipair/spacestudyship/controller/timer/TimerSessionControllerTest.java
  • docs/api-specs/03_timer.md
  • docs/superpowers/plans/2026-05-26-today-stats-cumulative-fields.md
  • docs/superpowers/specs/2026-05-26-today-stats-cumulative-fields-design.md

Comment on lines +250 to +252
#### 시간 경계 정의
- **오늘**: `KST 00:00:00` ~ `KST 23:59:59`
- **이번 달**: 이번 달 1일 `KST 00:00:00` ~ 다음 달 1일 `KST 00:00:00` (반열림 `[start, end)`)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

오늘 경계 표기를 반열림으로 통일해 주세요.

Line 251의 KST 00:00:00 ~ KST 23:59:59 표기는 Line 252의 반열림 표기와 기준이 달라 경계 해석이 흔들릴 수 있습니다. 오늘[KST 00:00:00, 다음날 KST 00:00:00)로 맞추는 게 안전합니다.

🤖 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 `@docs/api-specs/03_timer.md` around lines 250 - 252, Update the "오늘"
time-bound description to use a half-open interval consistent with "이번 달":
replace "KST 00:00:00 ~ KST 23:59:59" with "[KST 00:00:00, 다음날 KST 00:00:00)" so
both "오늘" and "이번 달" use the same [start, end) convention; ensure the heading
"오늘" text is the only change and keep the timezone labels (KST) intact.

Comment on lines +214 to +215
- 기존 today/streak 테스트가 모두 통과해야 함 (수정 없이).

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

회귀 테스트 설명을 실제 변경사항과 일치시켜 주세요.

여기서는 “기존 today/streak 테스트가 수정 없이 통과”라고 되어 있는데, 같은 PR의 구현 계획에서는 신규 repository 호출 때문에 기존 테스트에 stub 추가가 필요하다고 명시되어 있습니다. 문구를 “기존 검증 의도는 유지하되, 시그니처/호출 변경에 따른 최소 테스트 보정 후 통과”로 정렬해 두면 실행자가 혼동하지 않습니다.

🤖 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 `@docs/superpowers/specs/2026-05-26-today-stats-cumulative-fields-design.md`
around lines 214 - 215, 문구 "기존 today/streak 테스트가 모두 통과해야 함 (수정 없이)"를 문서 전반의 관련
설명과 일치하도록 수정하세요; 구체적으로 해당 문구를 "기존 검증 의도는 유지하되, 시그니처/호출 변경에 따른 최소 테스트 보정 후 통과"로
바꿔서, 같은 PR에서 새 repository 호출로 인한 테스트 스텁/보정 필요성을 명확히 표시하고 실행자가 혼동하지 않도록 업데이트하세요.

@EM-H20 EM-H20 merged commit f6d7929 into main May 27, 2026
1 check passed
@github-actions

Copy link
Copy Markdown

🗑️ Preview 환경 삭제 완료!

항목
컨테이너 spacestudyship-pr-41
상태 삭제됨

다시 배포하려면: @suh-lab server build


🤖 이 댓글은 PR/Issue Preview 시스템에 의해 자동 생성되었습니다.

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.

1 participant