File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
src/main/kotlin/org/gitanimals/rank/app Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -25,13 +25,14 @@ class RankQueryFacade(
2525 size : Int ,
2626 rankType : RankQueryRepository .RankType ,
2727 ): List <RankResponse > {
28+ val calibratedRank = rank - 1
2829 require(size > 1 ) { " Size must be lager than 1. size: $size " }
2930 require(size <= 20 ) { " Maximum request size is 20. size: $size " }
30- require(rank >= 0 ) { " Rank must be larger than 0. rank: $rank " }
31+ require(calibratedRank >= 0 ) { " Rank must be larger than 0. rank: $rank " }
3132
3233 val rankWithIds = rankQueryRepository.findAllRank(
33- rankStartedAt = rank ,
34- limit = rank + size - 1 ,
34+ rankStartedAt = calibratedRank ,
35+ limit = calibratedRank + size - 1 ,
3536 rankType = rankType
3637 ).associate { it.rank to it.id }
3738
You can’t perform that action at this time.
0 commit comments