This commit is contained in:
InsanusMokrassar 2020-04-10 14:01:13 +06:00
parent d0b0cad94c
commit 36480eb539
5 changed files with 14 additions and 10 deletions

View File

@ -48,8 +48,3 @@ fun calculatePagesNumber(datasetSize: Long, pageSize: Int): Int {
fun calculatePagesNumber(datasetSize: Int, pageSize: Int): Int { fun calculatePagesNumber(datasetSize: Int, pageSize: Int): Int {
return ceil(datasetSize.toDouble() / pageSize).toInt() return ceil(datasetSize.toDouble() / pageSize).toInt()
} }
/**
* Calculates pages count for given [datasetSize]
*/
inline fun Pagination.calculatePagesNumber(datasetSize: Int): Int = calculatePagesNumber(datasetSize, size)

View File

@ -10,7 +10,7 @@ const val defaultExtraLargePageSize = 15
@Suppress("NOTHING_TO_INLINE", "FunctionName") @Suppress("NOTHING_TO_INLINE", "FunctionName")
inline fun FirstPagePagination(size: Int = defaultMediumPageSize) = SimplePagination( inline fun FirstPagePagination(size: Int = defaultMediumPageSize) = SimplePagination(
page = 0, page = 0,
size = defaultMediumPageSize size = size
) )
@Suppress("NOTHING_TO_INLINE") @Suppress("NOTHING_TO_INLINE")

View File

@ -26,11 +26,11 @@ class ContentSerialization {
} }
val stringified = registeredContentFakes.map { val stringified = registeredContentFakes.map {
Json.plain.stringify(RegisteredContent.serializer(), it) Json.stringify(RegisteredContent.serializer(), it)
} }
val parsed = stringified.map { val parsed = stringified.map {
Json.plain.parse(RegisteredContent.serializer(), it) Json.parse(RegisteredContent.serializer(), it)
} }
parsed.forEachIndexed { i, registeredContent -> assertEquals(registeredContentFakes[i], registeredContent) } parsed.forEachIndexed { i, registeredContent -> assertEquals(registeredContentFakes[i], registeredContent) }

View File

@ -38,7 +38,6 @@ kotlin {
dependencies { dependencies {
implementation kotlin('stdlib') implementation kotlin('stdlib')
api "org.jetbrains.exposed:exposed-core:$exposed_version" api "org.jetbrains.exposed:exposed-core:$exposed_version"
api "com.soywiz.korlibs.klock:klock:$klockVersion"
if ((project.hasProperty('RELEASE_MODE') && project.property('RELEASE_MODE') == "true") || System.getenv('RELEASE_MODE') == "true") { if ((project.hasProperty('RELEASE_MODE') && project.property('RELEASE_MODE') == "true") || System.getenv('RELEASE_MODE') == "true") {
api "com.insanusmokrassar:postssystem.core:$core_version" api "com.insanusmokrassar:postssystem.core:$core_version"
@ -53,6 +52,11 @@ kotlin {
implementation kotlin('test-annotations-common') implementation kotlin('test-annotations-common')
} }
} }
jvmMain {
dependencies {
implementation kotlin('stdlib')
}
}
jvmTest { jvmTest {
dependencies { dependencies {
@ -60,6 +64,12 @@ kotlin {
implementation "org.xerial:sqlite-jdbc:$test_sqlite_version" implementation "org.xerial:sqlite-jdbc:$test_sqlite_version"
} }
} }
jsMain {
dependencies {
implementation kotlin('stdlib')
}
}
} }
} }

View File

@ -1,3 +1,2 @@
exposed_version=0.23.1 exposed_version=0.23.1
test_sqlite_version=3.30.1 test_sqlite_version=3.30.1
test_junit_version=5.5.2