add an all plant filter

This commit is contained in:
gowthaman 2024-05-16 17:30:19 +05:30
parent cad5a647f1
commit ed1e7546a7

View File

@ -118,10 +118,11 @@ fun <T> applyVendorHelper(q: io.ebean.ExpressionList<T>, vids: List<Long>?) {
fun <T> applyPlantFilter(q: io.ebean.ExpressionList<T>, vids: List<Long>?) {
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() })
}
}