Skip to content

refactor : 공부 시작시 시작 시간 추가#91

Merged
Juhye0k merged 1 commit intodevfrom
time
May 3, 2026
Merged

refactor : 공부 시작시 시작 시간 추가#91
Juhye0k merged 1 commit intodevfrom
time

Conversation

@Juhye0k
Copy link
Copy Markdown
Contributor

@Juhye0k Juhye0k commented May 3, 2026

🚀 1. 개요

  • 공부시간 조회 시 시작 시간 추가

Summary by CodeRabbit

새로운 기능

  • 스터디 세션의 시작 시간 정보가 추가되었습니다. 사용자는 이제 활성 학습 세션의 정확한 시작 시간을 추적할 수 있으며, 이는 학습 시간 관리를 더욱 정확하게 해줍니다.

@Juhye0k Juhye0k requested a review from kon28289 May 3, 2026 08:30
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 3, 2026

Walkthrough

StudySessionResponse 레코드에 LocalDateTime startTime 필드를 추가하고, StudySessionService.getTodayStudySession이 활성 세션에서 시작 시간을 추출하여 반환하도록 업데이트했습니다.

Changes

Study Session 시간 정보 노출

Layer / File(s) Summary
데이터 모양
src/main/java/com/gpt/geumpumtabackend/study/dto/response/StudySessionResponse.java
레코드에 LocalDateTime startTime 필드를 추가하고, 정적 팩토리 메서드 of(...)의 서명을 업데이트하여 새로운 필드를 포함합니다.
서비스 레이어 통합
src/main/java/com/gpt/geumpumtabackend/study/service/StudySessionService.java
getTodayStudySession이 활성 StudySession을 조회하여 startTime을 추출하고, 업데이트된 StudySessionResponse.of(...)에 전달하도록 변경합니다.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10분

Possibly related PRs

Suggested labels

enhancement

Suggested reviewers

  • kon28289

Poem

🐰 시간의 흐름을 담아내니,
세션의 시작을 기억하게 되고,
공부의 여정이 더욱 명확해지네! 📚✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive PR 설명이 필수 섹션 중 일부만 작성되었으며, 주요 변경사항 및 스크린샷 섹션이 누락되어 있습니다. 2. 주요 변경 사항 섹션에서 수정된 파일들의 구체적인 변경 내용과 3. 스크린샷 섹션에 API 테스트 결과를 추가하여 설명을 보완해주세요.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed PR 제목이 주요 변경 사항을 명확하게 반영하고 있으며, 공부 시작 시간 추가라는 핵심 변경 사항을 간결하게 설명하고 있습니다.
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 time

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@src/main/java/com/gpt/geumpumtabackend/study/service/StudySessionService.java`:
- Around line 41-50: The getTodayStudySession method in StudySessionService is
missing a read-only transaction: add transactional semantics by annotating the
StudySessionService class with `@Transactional`(readOnly = true) (importing
org.springframework.transaction.annotation.Transactional) and then explicitly
annotate any mutating service methods (e.g., create/update/delete methods in
StudySessionService) with `@Transactional` (without readOnly) so writes are
handled correctly; alternatively, if you prefer method-level scope, annotate
getTodayStudySession with `@Transactional`(readOnly = true) instead of
class-level.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a41d83ab-7743-4c5d-a289-a71e8db6177a

📥 Commits

Reviewing files that changed from the base of the PR and between 4685946 and 556cbd8.

📒 Files selected for processing (2)
  • src/main/java/com/gpt/geumpumtabackend/study/dto/response/StudySessionResponse.java
  • src/main/java/com/gpt/geumpumtabackend/study/service/StudySessionService.java

Comment on lines 41 to 50
public StudySessionResponse getTodayStudySession(Long userId) {
LocalDateTime startOfDay = LocalDate.now().atStartOfDay();
LocalDateTime now = LocalDateTime.now();
boolean isStudying = studySessionRepository.findByUser_IdAndStatus(userId, StudyStatus.STARTED).isPresent();
StudySession activeSession = studySessionRepository.findByUser_IdAndStatus(userId, StudyStatus.STARTED)
.orElse(null);
boolean isStudying = activeSession != null;
LocalDateTime startTime = isStudying ? activeSession.getStartTime() : null;
Long totalStudySession = studySessionRepository.sumCompletedStudySessionByUserId(userId, startOfDay, now);
return StudySessionResponse.of(totalStudySession,isStudying);
return StudySessionResponse.of(totalStudySession, isStudying, startTime);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

조회 메서드 트랜잭션 설정이 빠져 있습니다.

getTodayStudySession는 읽기 전용 로직이므로 readOnly 트랜잭션 정책을 적용해 주세요. 현재 클래스/메서드 기준으로 조회 기본 정책이 명시되지 않았습니다.

🔧 제안 수정안
 `@Service`
 `@RequiredArgsConstructor`
 `@Slf4j`
+@Transactional(readOnly = true)
 public class StudySessionService {
@@
-    public StudySessionResponse getTodayStudySession(Long userId) {
+    public StudySessionResponse getTodayStudySession(Long userId) {
         LocalDateTime startOfDay = LocalDate.now().atStartOfDay();
         LocalDateTime now = LocalDateTime.now();
         StudySession activeSession = studySessionRepository.findByUser_IdAndStatus(userId, StudyStatus.STARTED)
                 .orElse(null);

As per coding guidelines "src/main/java/com/gpt/geumpumtabackend//service//*.java: Apply @Transactional appropriately, using readOnly = true for read-only operations" and "**/*Service.java: Use class-level @Transactional(readOnly = true) and add @Transactional to write methods".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/main/java/com/gpt/geumpumtabackend/study/service/StudySessionService.java`
around lines 41 - 50, The getTodayStudySession method in StudySessionService is
missing a read-only transaction: add transactional semantics by annotating the
StudySessionService class with `@Transactional`(readOnly = true) (importing
org.springframework.transaction.annotation.Transactional) and then explicitly
annotate any mutating service methods (e.g., create/update/delete methods in
StudySessionService) with `@Transactional` (without readOnly) so writes are
handled correctly; alternatively, if you prefer method-level scope, annotate
getTodayStudySession with `@Transactional`(readOnly = true) instead of
class-level.

Copy link
Copy Markdown
Contributor

@kon28289 kon28289 left a comment

Choose a reason for hiding this comment

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

수고하셨습니다!

@Juhye0k Juhye0k merged commit 71bff6d into dev May 3, 2026
4 checks passed
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.

2 participants