Skip to content

fix(quiz): 유사퀴즈 제출 시각을 주입 Clock(Asia/Seoul)으로 계산 - #686

Merged
GANGHYEON02 merged 2 commits into
developfrom
fix/quiz-review-completion-clock
Jul 24, 2026
Merged

fix(quiz): 유사퀴즈 제출 시각을 주입 Clock(Asia/Seoul)으로 계산#686
GANGHYEON02 merged 2 commits into
developfrom
fix/quiz-review-completion-clock

Conversation

@dlxodus02

@dlxodus02 dlxodus02 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

📌 연관 이슈


📝 작업 내용

  • SimilarQuizSubmissionService 에 팀 표준 Clock(ClockConfig, Asia/Seoul) 주입
  • 제출 시각을 LocalDateTime.now()LocalDateTime.now(clock) 로 변경
  • 복습 완료 전진(completeTodayReviews)의 '오늘'이 스케줄 조회의 KST '오늘'과 정렬되도록 수정
  • 단위 테스트에 고정 Clock 주입(생성자 시그니처 변경 대응)

🖥️ 프론트엔드 연동 가이드 (API 명세)

⚠️ API 계약(엔드포인트·요청·응답 스키마) 변경 없음. 서버 내부 시각 계산만 수정한 동작 버그 픽스입니다.

1. 영향 엔드포인트

  • POST /api/similar-quizzes/{similarQuizId}/submit : 제출 시 복습 완료 전진 (동작 정확도 개선)
  • GET /api/schedule/me/today, /api/schedule/me : 복습(REVIEW) 항목 노출 (제출 후 정상적으로 사라짐)

2. 요청 파라미터 (Request)

파라미터명 위치 필수 설명
(변경 없음) - - 기존 스키마 그대로

3. 정상 응답 예시

변경 없음

4. ⚠️ 프론트엔드 참고 및 주의사항

  • qa_full 제보('/me/today 복습 누락')의 1차 진단(review_card 미조인)은 사실이 아니었습니다. 두 엔드포인트는 동일 쿼리를 씁니다.
  • 이 PR은 KST 새벽(00:00~08:59) 제출 시 복습이 완료 처리되지 않던 결함을 고칩니다.
  • 캘린더에 초록 막대가 보이는데 오늘 할 일엔 없다면, 그 복습의 due 날짜가 오늘이 아닌 미래일 가능성이 큽니다(정상 동작). 막대가 찍힌 정확한 날짜칸 확인 요청드립니다.

🚨 주요 에러 코드 및 예외 (Exceptions)

  • 신규/변경 에러 코드 없음.

💡 백엔드 리뷰 포인트 (Backend Review)

  • 아키텍처 및 도메인: 읽기(study_schedule)는 Clock 사용 / 쓰기(quiz)는 raw now() 였던 도메인 간 시각 기준 불일치를 quiz 쪽에 Clock 주입으로 정렬. quiz 도메인 전반이 아직 raw .now() 다수(QuizController 등) — 후속 정리 대상.
  • 우려되는 부분이나 고민: review_card 초기 due 시딩 경로가 코드 밖(SQL/배치)이라, 그쪽 타임존도 KST 정합인지 별도 확인 필요.

✅ 체크리스트

  • 코드 컨벤션을 준수했습니다.
  • 불필요한 주석 및 콘솔 로그를 제거했습니다.
  • API 기능이 정상 동작하는지 테스트했습니다.
  • 예외(잘못된 값) 상황에 대한 검증 및 테스트를 통과했습니다.

Summary by CodeRabbit

  • 버그 수정
    • 퀴즈 제출 및 당일 복습 완료 시간이 서울 시간 기준으로 일관되게 처리됩니다.
    • 자정 전후 제출 기록과 복습 완료 상태가 시스템 기본 시간대에 따라 달라지는 문제를 개선했습니다.

복습 완료 전진의 '오늘'이 스케줄 조회(ScheduleController)의 KST '오늘'과
어긋나던 문제 수정. LocalDateTime.now() 는 JVM 기본 타임존(컨테이너 UTC)을
써서, KST 00:00~08:59 구간에 제출하면 today(UTC)=어제(KST)가 되어
오늘 due 복습 카드가 전진되지 않고(완료 무반영) due 날짜도 하루 밀렸다.
팀 표준 Clock(ClockConfig, Asia/Seoul)을 주입해 now(clock)로 계산한다.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@dlxodus02, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 38 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 332209af-4c61-4b6e-89d5-e2a251c508fd

📥 Commits

Reviewing files that changed from the base of the PR and between 3930478 and e8c7d7b.

📒 Files selected for processing (1)
  • src/test/java/com/wanted/backend/domain/quiz/application/service/SimilarQuizSubmissionServiceTest.java
📝 Walkthrough

Walkthrough

유사퀴즈 제출 시각 계산이 JVM 기본 타임존 대신 주입된 Asia/Seoul Clock을 사용하도록 변경되었습니다. 테스트는 고정된 Clock을 주입해 제출 및 복습 완료 시각을 검증합니다.

Changes

유사퀴즈 제출 시각 타임존 정렬

Layer / File(s) Summary
Clock 주입 및 제출 시각 계산
src/main/java/com/wanted/backend/domain/quiz/application/service/SimilarQuizSubmissionService.java, src/test/java/com/wanted/backend/domain/quiz/application/service/SimilarQuizSubmissionServiceTest.java
서비스 생성자에 Clock 의존성이 추가되고 submittedAtLocalDateTime.now(clock)으로 계산됩니다. 테스트는 Asia/Seoul 고정 Clock을 주입합니다.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: yoonjongho1122

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed 제출 시각을 주입 Clock으로 계산하도록 바뀐 핵심 변경을 정확히 요약합니다.
Description check ✅ Passed 연관 이슈, 작업 내용, FE 가이드, 예외, 리뷰 포인트, 체크리스트가 모두 채워져 템플릿을 충분히 충족합니다.
Linked Issues check ✅ Passed #685의 KST Clock 주입, now(clock) 적용, 새벽 오작동 수정, 결정적 테스트 추가 요구를 충족합니다.
Out of Scope Changes check ✅ Passed 변경 범위가 서비스의 시각 계산 수정과 이에 따른 테스트 보강에 한정되어 있어 불필요한 이탈이 보이지 않습니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/quiz-review-completion-clock

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 Jul 24, 2026

Copy link
Copy Markdown

Test Results

0 tests  ±0   0 ✅ ±0   0s ⏱️ ±0s
0 suites ±0   0 💤 ±0 
0 files   ±0   0 ❌ ±0 

Results for commit e8c7d7b. ± Comparison against base commit 1491ea0.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Jul 24, 2026

Copy link
Copy Markdown

Gate 2 · 결정론 판정

88 tests  ±0   82 ✅ ±0   0s ⏱️ ±0s
29 suites ±0    6 💤 ±0 
29 files   ±0    0 ❌ ±0 

Results for commit e8c7d7b. ± Comparison against base commit 1491ea0.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Jul 24, 2026

Copy link
Copy Markdown

Gate 1 · 결정론 규칙

16 tests  ±0   16 ✅ ±0   0s ⏱️ -1s
 3 suites ±0    0 💤 ±0 
 3 files   ±0    0 ❌ ±0 

Results for commit e8c7d7b. ± Comparison against base commit 1491ea0.

♻️ This comment has been updated with latest results.

@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: 1

🤖 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
`@src/test/java/com/wanted/backend/domain/quiz/application/service/SimilarQuizSubmissionServiceTest.java`:
- Around line 53-54: SimilarQuizSubmissionServiceTest의 고정 시각을 KST 08:30인
2026-05-11T23:30:00Z로 변경해 자정~08:59 경계를 재현하세요. 제출 결과의 submittedAt과
completeTodayReviews에 전달된 시각을 서로 비교하는 대신 각각 LocalDateTime.of(2026, 5, 12, 8,
30)인지 직접 단언해 실제 제출 시각과 clock 사용을 검증하세요.
🪄 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: ASSERTIVE

Plan: Pro Plus

Run ID: 37b9e355-7f0c-46bd-97b5-788aa6689727

📥 Commits

Reviewing files that changed from the base of the PR and between 1491ea0 and 3930478.

📒 Files selected for processing (2)
  • src/main/java/com/wanted/backend/domain/quiz/application/service/SimilarQuizSubmissionService.java
  • src/test/java/com/wanted/backend/domain/quiz/application/service/SimilarQuizSubmissionServiceTest.java

고정 Clock을 KST 10:00 → UTC 23:30(KST 익일 08:30)으로 옮겨 버그가
재현되던 00:00~08:59 경계를 실제로 통과시키고, submittedAt·복습 전진 인자가
LocalDateTime.of(2026,5,12,8,30)인지 절대값으로 단언한다. 두 값의 동일성만
검사하던 기존 방식은 구현이 raw now()로 되돌아가도 통과해 회귀를 못 잡았다.
(CodeRabbit 리뷰 반영)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@GANGHYEON02 GANGHYEON02 left a comment

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.

확인했습니다

@GANGHYEON02
GANGHYEON02 merged commit 327fde3 into develop Jul 24, 2026
11 checks passed
dlxodus02 added a commit that referenced this pull request Jul 24, 2026
release: develop → main (#686 유사퀴즈 제출 Clock 정합 · #687 오토스케일링 검증 대시보드)
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] 유사퀴즈 제출 시각이 UTC로 계산돼 KST 새벽 복습 완료가 누락됨

2 participants