Skip to content

feat: daily ranking reward/#684#686

Merged
hjbin-25 merged 4 commits into
developfrom
feat/daily-ranking-reward/#684
Apr 15, 2026
Merged

feat: daily ranking reward/#684#686
hjbin-25 merged 4 commits into
developfrom
feat/daily-ranking-reward/#684

Conversation

@hjbin-25

Copy link
Copy Markdown
Member

변경사항

  • 매일 KST 06:00에 전날 하루 동안 쌓은 EXP 기준 상위 3명에게 쿠키를 지급하는 기능 추가
    • 1위: 1000 쿠키 / 2위: 500 쿠키 / 3위: 300 쿠키
  • user_exp_history 테이블에서 특정 날짜의 EXP 합산 상위 N명 조회 쿼리 추가 (SEASON_RESET 카테고리 제외)
  • UserExpHistoryRepositoryPort / UserExpHistoryPersistenceAdapterfindTopUserIdsByDailyExp 메서드 추가
  • DailyRankingRewardService — 전날 날짜(Asia/Seoul 기준 today - 1)로 상위 3명 조회 후 쿠키 지급
  • DailyRankingRewardScheduler@Scheduled(cron = "0 0 6 * * *", zone = "Asia/Seoul") 로 매일 06:00 실행
  • 서비스 유닛 테스트 7개, 스케줄러 위임 테스트 1개 추가

관련 이슈

Closes #684

추가 컨텍스트

  • 보상 기준 날짜는 스케줄러가 실행되는 당일이 아닌 전날 (minusDays(1))
    • 06:00에 실행되므로 자정~06:00 사이 EXP가 반영되지 않는 문제를 방지
  • 동점자 처리는 DB 조회 순서(GROUP BY + ORDER BY) 기준으로 한 명만 선정 (별도 tie-break 없음)
  • 유저를 찾을 수 없는 경우 해당 순위를 스킵하고 다음 순위 보상은 정상 지급
  • 스케줄러 실행 실패 시 예외를 catch하여 로그만 남기고 다른 06:00 스케줄러(UserAttendanceInitScheduler 등)에 영향 없음

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request implements a daily ranking reward system that grants cookies to the top three users based on their daily experience accumulation. The implementation includes a new native SQL query in the repository, a service layer to process rewards with row-level locking, and a Spring scheduler configured for daily execution. Review feedback suggests enhancing the ranking query to filter out inactive or deleted users and adding a safety check in the reward loop to prevent potential array index out-of-bounds exceptions if configuration constants are modified.

@hjbin-25 hjbin-25 assigned hjbin-25 and unassigned hjbin-25 Apr 14, 2026
@hjbin-25 hjbin-25 added enhancement 새로운 기능 추가 labels Apr 14, 2026
@hjbin-25 hjbin-25 force-pushed the feat/daily-ranking-reward/#684 branch from c25100e to 59e06d8 Compare April 14, 2026 23:57
@hjbin-25 hjbin-25 force-pushed the feat/daily-ranking-reward/#684 branch from 6b6baae to efd305b Compare April 15, 2026 07:00
@hjbin-25 hjbin-25 merged commit 358ab56 into develop Apr 15, 2026
1 check passed
@hjbin-25 hjbin-25 deleted the feat/daily-ranking-reward/#684 branch April 15, 2026 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement 새로운 기능 추가

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants