diff --git a/src/main/kotlin/com/restapi/controllers/Filters.kt b/src/main/kotlin/com/restapi/controllers/Filters.kt index 1f19415..66d18ca 100644 --- a/src/main/kotlin/com/restapi/controllers/Filters.kt +++ b/src/main/kotlin/com/restapi/controllers/Filters.kt @@ -118,10 +118,11 @@ fun applyVendorHelper(q: io.ebean.ExpressionList, vids: List?) { fun applyPlantFilter(q: io.ebean.ExpressionList, vids: List?) { - if (vids.isNullOrEmpty()) { + val v = vids?.filter { it > 0 } ?: emptyList() + if (v.isEmpty()) { q.`in`("unloadingPlantId", Session.currentUserPlants().map { it.plantId }) } else { - q.`in`("unloadingPlantId", vids.map { it.toString() }) + q.`in`("unloadingPlantId", v.map { it.toString() }) } }