Skip to content

Commit

Permalink
🔀 병합
Browse files Browse the repository at this point in the history
  • Loading branch information
Huuuunee committed Aug 18, 2023
2 parents 1a94387 + 9cedc52 commit 8d1742c
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 8d1742c

Please sign in to comment.