hotfix for calculating of pages size in pagination

This commit is contained in:
InsanusMokrassar 2020-04-12 20:26:05 +06:00
parent 967aa21a9c
commit 1087558670
3 changed files with 4 additions and 6 deletions

View File

@ -8,4 +8,4 @@ uuidVersion=0.1.0
gradle_bintray_plugin_version=1.8.4 gradle_bintray_plugin_version=1.8.4
core_version=0.4.0 core_version=0.4.1

View File

@ -45,6 +45,4 @@ fun calculatePagesNumber(datasetSize: Long, pageSize: Int): Int {
/** /**
* Calculates pages count for given [datasetSize] * Calculates pages count for given [datasetSize]
*/ */
fun calculatePagesNumber(datasetSize: Int, pageSize: Int): Int { fun calculatePagesNumber(datasetSize: Int, pageSize: Int): Int = calculatePagesNumber(datasetSize.toLong(), pageSize)
return ceil(datasetSize.toDouble() / pageSize).toInt()
}

View File

@ -15,7 +15,7 @@ fun <T> List<T>.createPaginationResult(
commonObjectsNumber: Long commonObjectsNumber: Long
) = PaginationResult( ) = PaginationResult(
pagination.page, pagination.page,
calculatePagesNumber(commonObjectsNumber, size), calculatePagesNumber(commonObjectsNumber, pagination.size),
this, this,
size pagination.size
) )