-
Notifications
You must be signed in to change notification settings - Fork 0
feat: 순공 시간 랭킹 조회 API 구현 #104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Soundbar91
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다
| ## 설명 | ||
| - 페이지네이션으로 랭킹을 조회합니다. | ||
| - sort는 월간(MONTHLY) 또는 일간(DAILY) 기준으로 정렬됩니다. | ||
| - 시간이 같은 경우 다른 기간의 시간을 기준으로 추가 정렬됩니다. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
R
해당 로직은 논의가 필요해 보입니다. 일간 랭킹인데 월간 랭킹이 영향을 미치는 건 조금 적절하지 않다고 생각합니다.
동일 등수로 하거나, 정렬 기준을 독립적으로 가져가는 게 좋아보여요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
공동 등수를 적용 한다면 페이지네이션으로 조회할 때 등수를 매기기 까다로워서 위와 같은 방식을 채택했습니다.
일간 랭킹에서 두 유저간의 일간 공부 시간이 동일하다면 등수를 동일하게 두기보다 다음 기준인 월간 공부 시간으로 구해야하지 않나? 라는 생각입니다.
이건 오늘 회의에 안건으로 꺼내봐야 할 것 같습니다!
src/main/java/gg/agit/konect/domain/studytime/dto/StudyTimeRankingsResponse.java
Show resolved
Hide resolved
| @Entity | ||
| @Table(name = "study_time_ranking") | ||
| @NoArgsConstructor(access = PROTECTED) | ||
| public class StudyTimeRanking extends BaseEntity { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C
랭킹 테이블을 분리하신 이유가 있으실까요 👀 일간, 월간 데이터를 가지고 쿼리로 집계해서 가져오는 게 깔끔하지 않나 라는 생각을 했습니다.
실시간성이 필요한지는 논의를 해봐야할 거 같은데, 만약 실시간성이 중요하다면 스케쥴링 주기를 타이트하게 가져가야하고 그렇지 않다면 스케쥴링 주기를 얼마로 가져갈지 정해야할 거 같아요. 앱에다가 X분 주기로 업데이트가 된다라는 메시지도 보여줘야할 거 같구요.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
랭킹 테이블을 분리하지 않는다면 매 요청에 따라 매번 시간 데이터에서 순위를 집계해야 하는데, 너무 비효율적이라 판단했습니다.
사실 실시간이라고 하기도 애매한게 타이머를 종료시켜야 시간이 누적되기에 굳이 실시간으로 할 필요가 없다면 자정마다 스케줄링을 돌려 전 날의 랭킹을 보여주도록 하는 것도 나쁘지 않다고 생각합니다.
이것도 오늘 회의에 얘기를 해봐야 할 것 같아요
src/main/java/gg/agit/konect/domain/studytime/model/StudyTimeRankingId.java
Outdated
Show resolved
Hide resolved
src/main/java/gg/agit/konect/domain/studytime/service/StudyTimeRankingService.java
Outdated
Show resolved
Hide resolved
src/main/resources/db/migration/V5__create_studytime_ranking_table.sql
Outdated
Show resolved
Hide resolved
src/main/resources/db/migration/V5__create_studytime_ranking_table.sql
Outdated
Show resolved
Hide resolved
변경사항
|
🔍 개요
🚀 주요 변경 내용
GET /studytimes/rankings엔드포인트를 추가했습니다.페이지네이션으로 동아리, 학번, 개인별 랭킹을 조회합니다.
랭킹 기준은
일,월별로 나뉘며, 시간이 동일한 경우 다른 기준으로 조회하고 이마저도 동일하다면id를 기준으로 순위를 구합니다.개인별 랭킹의 경우 이름을 마스킹 처리 합니다. ex)
김 -> 김/김철 -> 김*/김철수 -> 김*수/김철철수 -> 김**수각 랭킹별 테이블을 분리해야 하나 고민했는데, 그렇게 되면 테이블 구조가 더러워질 것 같아 하나의 테이블에 복합키로 구분지을 수 있도록 했습니다.
💬 참고 사항
다음 작업은 내 랭킹 조회, 랭킹 집계 스케줄링 처리를 진행할 예정입니다.
아래는 테스트를 위한 더미 데이터 생성 프로시저입니다. 개인별 랭킹만 추가하므로 참고바랍니다.
✅ Checklist (완료 조건)