Skip to content

Commit

Permalink
Merge pull request #177 from GSM-MSG/hotfix/176-page-500-error
Browse files Browse the repository at this point in the history
πŸ”€ :: page 500 μ—λŸ¬ ν•΄κ²°
  • Loading branch information
louis7308 authored Aug 18, 2023
2 parents 8530fc1 + 9e9d3a2 commit 34b9739
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ class FindAllUseCase(
}

fun List<Student.StudentWithUserInfo>.toDomainPageWithUserInfo(page: Int, size: Int): Student.StudentWithPageInfo {
val startIndex = page * size
val startIndex = (page - 1) * size
val endIndex = (startIndex + size).coerceAtMost(this.size)
val content = this.subList(startIndex, endIndex)
val content = if (startIndex <= endIndex) this.subList(startIndex, endIndex) else emptyList()

val totalPages = (this.size + size - 1) / size
val isLast = page >= totalPages - 1
val isLast = page >= totalPages

return Student.StudentWithPageInfo(
students = content,
page = page + 1,
page = page,
contentSize = content.size,
totalSize = this.size.toLong(),
last = isLast
Expand Down

0 comments on commit 34b9739

Please sign in to comment.