From f6ceaa96d28d29af4c7c7cba2bc639789ce403b9 Mon Sep 17 00:00:00 2001 From: aminecmi Date: Sun, 17 Jul 2022 22:26:26 +0200 Subject: [PATCH] Fixing warnings. --- src/main/kotlin/dao/DB.kt | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/main/kotlin/dao/DB.kt b/src/main/kotlin/dao/DB.kt index 86b4cce..50f57eb 100644 --- a/src/main/kotlin/dao/DB.kt +++ b/src/main/kotlin/dao/DB.kt @@ -83,11 +83,7 @@ class DB { transaction { val allITems = Item.find { Items.list eq listId }.sortedBy { it.position } val firstChecked = allITems.firstOrNull { it.checked } - val p = if (firstChecked != null) { - firstChecked?.position - } else { - (allITems.lastOrNull()?.position ?: - 1) + 1 - } + val p = firstChecked?.position ?: ((allITems.lastOrNull()?.position ?: - 1) + 1) val listOpt = List.findById(listId) if (listOpt != null) { reorderElements(listId, p) @@ -165,14 +161,14 @@ class DB { firstChecked?.position ?: allITems.lastOrNull()?.position } - item?.checked = body.checked + item.checked = body.checked } if (p != null) { reorderElements(listId, p, itemId) - item?.position = p + item.position = p } if (body.content != null) { - item?.content = body.content + item.content = body.content } ctx.json(item.toView()) } else {