Fixing warnings.

This commit is contained in:
aminecmi 2022-07-17 22:26:26 +02:00
parent b3a382ffa1
commit f6ceaa96d2

View File

@ -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 {