Skip to content

Commit

Permalink
Filter instances in DeleteSavedFormListViewModel
Browse files Browse the repository at this point in the history
  • Loading branch information
grzesiek2010 committed Apr 28, 2024
1 parent db7ade0 commit 2d30b34
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import androidx.lifecycle.ViewModel
import androidx.lifecycle.asLiveData
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.map
import org.odk.collect.android.instancemanagement.InstancesDataService
import org.odk.collect.androidshared.async.TrackableWorker
import org.odk.collect.androidshared.data.Consumable
Expand Down Expand Up @@ -39,6 +40,7 @@ class SavedFormListViewModel(
}

val formsToDisplay: LiveData<List<Instance>> = instancesDataService.instances
.map { instances -> instances.filter { instance -> instance.deletedDate == null } }
.combine(_sortOrder) { instances, order ->
when (order) {
SortOrder.NAME_DESC -> {
Expand Down

0 comments on commit 2d30b34

Please sign in to comment.