Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Walkthroughbuild.gradle에서 Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/main/java/com/gpt/geumpumtabackend/study/repository/StudySessionRepository.java (1)
100-109:totalMillis계산에서/1000나눗셈이 누락되었습니다.
totalMillis계산 시TIMESTAMPDIFF(MICROSECOND, ...)결과를 1000으로 나누지 않아 마이크로초가 반환됩니다. 같은 쿼리의 RANK와 ORDER BY, 그리고 다른 모든 랭킹 쿼리들은/1000을 적용하여 밀리초로 변환하고 있습니다.이로 인해
totalMillis값이 예상보다 1000배 크게 반환되어 데이터 불일치가 발생합니다.CAST(COALESCE(SUM( TIMESTAMPDIFF(MICROSECOND, GREATEST(s.start_time, :periodStart), CASE WHEN s.end_time IS NULL THEN :periodEnd WHEN s.end_time > :periodEnd THEN :periodEnd ELSE s.end_time END - ) + ) / 1000 ), 0) AS SIGNED) as totalMillis,
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
build.gradle(1 hunks)src/main/java/com/gpt/geumpumtabackend/study/repository/StudySessionRepository.java(7 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-11-11T11:48:29.664Z
Learnt from: kon28289
Repo: Geumpumta/backend PR: 16
File: src/main/java/com/gpt/geumpumtabackend/study/repository/StudySessionRepository.java:264-287
Timestamp: 2025-11-11T11:48:29.664Z
Learning: In the Geumpumta backend project, study session statistics (daily, weekly, monthly, grass) intentionally exclude in-progress sessions where end_time is NULL. Only completed sessions (with non-null end_time) should be counted in the statistics calculations.
Applied to files:
src/main/java/com/gpt/geumpumtabackend/study/repository/StudySessionRepository.java
🔇 Additional comments (3)
src/main/java/com/gpt/geumpumtabackend/study/repository/StudySessionRepository.java (3)
42-87: LGTM!
TIMESTAMPDIFF(MICROSECOND, ...) / 1000로직이 totalMillis, RANK, ORDER BY에 일관되게 적용되어 밀리초 정밀도가 올바르게 유지됩니다.
143-183: LGTM!학과 랭킹 쿼리의 모든 시간 계산 로직이 일관되게
MICROSECOND / 1000을 사용하여 밀리초를 정확히 반환합니다.
185-225: LGTM!확정된 학과 랭킹 쿼리도 모든 시간 계산에서 일관된 변환 로직을 사용하고 있습니다.
🚀 1. 개요
랭킹 집계 쿼리의 시간 계산 정밀도를 보정하는 작업을 포함합니다.
📝 2. 주요 변경 사항
공부 시간 계산 로직 정밀도 보정 (
StudySessionRepository)TIMESTAMPDIFF(SECOND, ...)로 초 단위 차이를 구한 뒤 1000을 곱하는 방식이라, 1초 미만의 시간(밀리초)이 소실되는 문제가 있었습니다.TIMESTAMPDIFF(MICROSECOND, ...)로 마이크로초 단위 차이를 구한 뒤 1000으로 나누는 방식으로 변경하여 밀리초 단위의 정밀도를 확보했습니다.calculateCurrentPeriodRanking(현재 기간 개인 랭킹)calculateFinalizedPeriodRanking(지난 기간 개인 랭킹)calculateCurrentDepartmentRanking(현재 기간 학과 랭킹)calculateFinalizedDepartmentRanking(지난 기간 학과 랭킹)Summary by CodeRabbit
릴리스 노트
Bug Fixes
Chores
✏️ Tip: You can customize this high-level summary in your review settings.