From ee9cd70e37710a758623fc76eea1dd8af8c47fc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=84=EC=8A=B9=EC=9B=90?= <78971821+louis7308@users.noreply.github.com> Date: Thu, 17 Aug 2023 20:35:13 +0900 Subject: [PATCH] =?UTF-8?q?:sparkles:=20::=20page=201=EC=9D=BC=EB=95=8C=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=20=EB=90=98=EA=B2=8C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../team/msg/sms/domain/student/usecase/FindAllUseCase.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/student/usecase/FindAllUseCase.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/student/usecase/FindAllUseCase.kt index a8db1af2..3a11f726 100644 --- a/sms-core/src/main/kotlin/team/msg/sms/domain/student/usecase/FindAllUseCase.kt +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/student/usecase/FindAllUseCase.kt @@ -42,16 +42,16 @@ class FindAllUseCase( } fun List.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