Skip to content

Commit

Permalink
hotfix: 랭킹 조회 업데이트
Browse files Browse the repository at this point in the history
  • Loading branch information
parksey committed Dec 4, 2023
1 parent 1601fd4 commit 06a36ad
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static TopRankingInfo topRankingResponse(int rank, long score, RankingInf

public static TopRankingInfo topRankingResponse(int rank, UpdateRanking updateRanking) {
return TopRankingInfo.builder()
.rank(rank + 1)
.rank(rank)
.score(updateRanking.score())
.nickname(updateRanking.rankingInfo().nickname())
.image(updateRanking.rankingInfo().image())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,17 @@ public void removeRanking(RankingInfo rankingInfo) {

public TopRankingResponse getMemberRanking(UpdateRanking myRankingInfo) {
List<TopRankingInfo> topRankings = getTopRankings();
Long myRanking = zSetRedisRepository.reverseRank(RANKING, myRankingInfo.rankingInfo());
long myRanking = zSetRedisRepository.reverseRank(RANKING, myRankingInfo.rankingInfo()) + 1;

Optional<TopRankingInfo> myTopRanking = topRankings.stream()
.filter(topRankingInfo -> Objects.equals(topRankingInfo.memberId(), myRankingInfo.rankingInfo().memberId()))
.findFirst();

if (myTopRanking.isPresent()) {
myRanking = (long)myTopRanking.get().rank();
myRanking = myTopRanking.get().rank();
}

TopRankingInfo myRankingInfoResponse = RankingMapper.topRankingResponse(myRanking.intValue(), myRankingInfo);
TopRankingInfo myRankingInfoResponse = RankingMapper.topRankingResponse((int)myRanking, myRankingInfo);

return RankingMapper.topRankingResponses(myRankingInfoResponse, topRankings);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/config

0 comments on commit 06a36ad

Please sign in to comment.