Skip to content

[FIX] 포커스 종료 시 클라이언트 집중 시간(durationSec) 반영 - #380

Merged
kjhyeon0620 merged 2 commits into
develop-demofrom
fix/#379-focus-end-duration-recent-banner
Oct 9, 2026
Merged

kjhyeon0620 merged 2 commits into
develop-demofrom
fix/#379-focus-end-duration-recent-banner

Conversation

@kjhyeon0620

@kjhyeon0620 kjhyeon0620 commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

📄 작업 내용 요약

  • 홈 '이어서 포커스하기' 배너(GET /api/v1/library/recent-focus) 응답 기준 수정
    • 종료된(endedAt not null) 가장 최근 포커스 기준으로 조회 (진행 중 포커스 제외)
    • focusTime: 해당 책의 오늘 포커스 시간 (포커스 홈 책별 todayFocusTime과 같은 기준, 자정 초기화, 오늘 기록 없으면 00:00:00)
    • page: 그 포커스 종료 시 입력한 endPage (미입력 시 null)
    • 해당 책이 완독(FINISHED)이면 result: null (다른 책으로 대체하지 않음)
  • 포커스 종료(POST /api/v1/focuses/end)에 선택 필드 durationSec(초) 추가
    • 종료 시트가 열려 있는 동안 멈춘 프론트 타이머 시간을 반영
    • 0 ≤ durationSec ≤ 서버 계산 경과 시간으로 보정, 종료 시각 = startedAt + durationSec
    • 미전달 시 기존 동작(서버 현재 시각) 유지

📎 Issue 번호


✅ 작업 목록

  • 기능 구현
  • 테스트 코드 작성
  • 문서 업데이트

Summary by CodeRabbit

  • 기능 개선
    • 포커스 종료 시 선택적으로 경과 시간을 지정할 수 있습니다. 지정한 시간이 서버에서 계산한 경과 시간을 넘으면 자동으로 보정됩니다.
    • 최근 포커스 정보는 종료된 기록을 기준으로 표시하며, 완료한 도서는 표시하지 않습니다. 포커스 시간은 해당 도서의 오늘 기록을 기준으로 하고, 기록이 없으면 00:00:00으로 표시합니다.
  • 문서
    • 포커스 종료 시간과 최근 포커스 정보의 계산 및 표시 기준을 안내합니다.

@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ef8fa713-57bb-437c-ad51-b2f8e0b3938c

📥 Commits

Reviewing files that changed from the base of the PR and between 5fbae49 and 0a3f218.


📒 Files selected for processing (11)
  • src/docs/asciidoc/focus.adoc
  • src/docs/asciidoc/library.adoc
  • src/main/java/app/nook/focus/dto/FocusRequestDto.java
  • src/main/java/app/nook/focus/repository/FocusRepository.java
  • src/main/java/app/nook/focus/service/FocusService.java
  • src/main/java/app/nook/library/service/LibraryQueryService.java
  • src/test/java/app/nook/controller/focus/FocusControllerTest.java
  • src/test/java/app/nook/controller/library/LibraryControllerTest.java
  • src/test/java/app/nook/focus/repository/FocusRepositoryTest.java
  • src/test/java/app/nook/focus/service/FocusServiceTest.java
  • src/test/java/app/nook/library/service/LibraryServiceTest.java

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.



Walkthrough

포커스 종료 요청에 선택 필드 durationSec를 추가했습니다. 서재의 최근 포커스 조회는 종료된 기록을 기준으로 하며, 응답의 페이지와 오늘 포커스 시간을 변경했습니다.

Changes

포커스 종료 시간 계산

Layer / File(s) Summary
durationSec 입력 및 종료 시각 계산
src/main/java/app/nook/focus/dto/FocusRequestDto.java, src/main/java/app/nook/focus/service/FocusService.java, src/test/java/app/nook/focus/service/FocusServiceTest.java, src/test/java/app/nook/controller/focus/FocusControllerTest.java, src/docs/asciidoc/focus.adoc
종료 요청에 0 이상의 선택 입력 durationSec를 추가했습니다. 값이 있으면 서버 경과 시간을 초과하지 않도록 보정하고, 계산한 종료 시각을 세션 분할과 응답에 반영합니다. 관련 테스트와 API 문서도 갱신했습니다.

서재 최근 포커스 조회

Layer / File(s) Summary
종료된 포커스 선택 및 응답 계산
src/main/java/app/nook/focus/repository/FocusRepository.java, src/main/java/app/nook/library/service/LibraryQueryService.java, src/test/java/app/nook/focus/repository/FocusRepositoryTest.java, src/test/java/app/nook/library/service/LibraryServiceTest.java, src/test/java/app/nook/controller/library/LibraryControllerTest.java, src/docs/asciidoc/library.adoc
최근 포커스 조회에서 종료되지 않은 기록을 제외합니다. 응답 페이지는 종료 페이지를 사용하고, focusTime은 해당 책의 오늘 포커스 시간 합계로 계산합니다. 완독 도서는 결과에서 제외하며 관련 테스트와 문서를 갱신했습니다.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: jiwonlee42

Merge Risk: ⚪ Minimal · up to 0a3f2

The change adds an optional durationSec to focus end requests and makes the recent-focus response use the latest ended focus. No concrete merge-blocking risk was identified. Note that focusTime reports today's time rather than the cumulative time requested in the linked issue.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check Warning 직접 연결된 [#379]의 종료 API 요구사항은 구현되었습니다. FocusEnd.durationSec는 선택 필드이며 @PositiveOrZero 검증을 사용합니다. FocusService.resolveEndedAt은 서버 경과 시간을 상한으로 보정하고 startedAt + durationSec를 종료 시각으로 사용합니다. 자정 분할, 누적… GET /api/v1/library/recent-focus의 focusTime 계산을 오늘 날짜 필터 없이 해당 책의 모든 종료된 포커스 기록 합계로 변경하십시오. 총 누적 시간, 종료 페이지, 완독 도서, durationSec 보정 및 자정 분할을 검증하는 자동화 테스트와 API 문서를 같은 기준으로 갱신하십시오.
Docstring Coverage Warning Docstring coverage is 5.41% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 37 functions across 9 files. (2 skipped: 2… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Out of Scope Changes check Passed 변경 사항은 [#379]의 두 coding objective에 연결됩니다. durationSec DTO·서비스·문서·컨트롤러 테스트 변경은 종료 시각 보정 요구사항을 지원합니다. 최근 포커스 repository·library service·테스트·문서 변경은 종료된 최신 포커스, 종료 페이지, 완독 도서 처리와 focusTime 응답을 구현합니다. …
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed 제목은 포커스 종료 시간(duration)과 최근 포커스 배너 변경을 모두 명시합니다. PR의 주요 변경 사항과 직접 관련되며 간결합니다.

Full details: Linked Issues check

Explanation

직접 연결된 [#379]의 종료 API 요구사항은 구현되었습니다. FocusEnd.durationSec는 선택 필드이며 @PositiveOrZero 검증을 사용합니다. FocusService.resolveEndedAt은 서버 경과 시간을 상한으로 보정하고 startedAt + durationSec를 종료 시각으로 사용합니다. 자정 분할, 누적 시간, 독서 이력, 타임라인 처리는 보정된 종료 시각을 사용합니다. 최근 포커스 조회도 종료된 포커스만 대상으로 하고, 종료 페이지와 완독 도서의 null 응답을 처리합니다. 그러나 [#379]는 focusTime에 해당 책의 총 누적 포커스 시간을 요구합니다. 현재 LibraryQueryService.getTodayFocusSec은 오늘 날짜의 기록만 합산합니다. 따라서 자정을 넘긴 기록과 이전 날짜의 기록이 focusTime에서 제외됩니다.


Full details: Docstring Coverage

Explanation

Docstring coverage is 5.41% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 37 functions across 9 files. (2 skipped: 2 unsupported.)



  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR


  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Overall Project 79.91% -0.01% 🍏
Files changed 98.25% 🍏

File Coverage
FocusService.java 97.91% 🍏
LibraryQueryService.java 93.92% -0.31% 🍏

@kjhyeon0620
kjhyeon0620 merged commit a01f2ec into develop-demo Oct 9, 2026
2 checks passed
@kjhyeon0620
kjhyeon0620 deleted the fix/#379-focus-end-duration-recent-banner branch October 9, 2026 16:41
@kjhyeon0620 kjhyeon0620 changed the title Fix/#379 focus end duration recent banner [FIX] 포커스 종료 시 클라이언트 집중 시간(durationSec) 반영 Oct 9, 2026
@kjhyeon0620 kjhyeon0620 mentioned this pull request Oct 20, 2026
4 tasks done
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.

[FIX] 포커스 종료 시간 산정 및 서재 이어서 포커스 배너 응답 오류 수정

1 participant