diff --git a/app/src/androidTest/java/org/dhis2/usescases/searchte/SearchTETest.kt b/app/src/androidTest/java/org/dhis2/usescases/searchte/SearchTETest.kt index 620daded12..577fedce04 100644 --- a/app/src/androidTest/java/org/dhis2/usescases/searchte/SearchTETest.kt +++ b/app/src/androidTest/java/org/dhis2/usescases/searchte/SearchTETest.kt @@ -171,6 +171,7 @@ class SearchTETest : BaseTest() { checkFilterCounter(totalFilterCount) checkCountAtFilter(enrollmentStatusFilter, filterCount) clickOnFilter() + waitToDebounce(2000) checkTEIsAreOpen() } } @@ -337,8 +338,10 @@ class SearchTETest : BaseTest() { clickOnOpenSearch() openNextSearchParameter("First name") typeOnNextSearchTextParameter(name) + waitToDebounce(2000) clickOnSearch() composeTestRule.waitForIdle() + } filterRobot { diff --git a/app/src/main/java/org/dhis2/usescases/searchTrackEntity/SearchTEIViewModel.kt b/app/src/main/java/org/dhis2/usescases/searchTrackEntity/SearchTEIViewModel.kt index dd76f60117..99807ebbf3 100644 --- a/app/src/main/java/org/dhis2/usescases/searchTrackEntity/SearchTEIViewModel.kt +++ b/app/src/main/java/org/dhis2/usescases/searchTrackEntity/SearchTEIViewModel.kt @@ -66,6 +66,8 @@ class SearchTEIViewModel( private val _legacyInteraction = MutableLiveData() val legacyInteraction: LiveData = _legacyInteraction + val filterManager: FilterManager = FilterManager.getInstance() + private val _refreshData = MutableLiveData(Unit) val refreshData: LiveData = _refreshData @@ -326,20 +328,20 @@ class SearchTEIViewModel( withContext(dispatchers.io()) { if ( searching && networkUtils.isOnline() && - FilterManager.getInstance().stateFilters.isEmpty() + filterManager.stateFilters.isEmpty() ) { searchRepository.transform( item, searchParametersModel.selectedProgram, false, - FilterManager.getInstance().sortingItem, + filterManager.sortingItem, ) } else { searchRepository.transform( item, searchParametersModel.selectedProgram, true, - FilterManager.getInstance().sortingItem, + filterManager.sortingItem, ) } } @@ -364,7 +366,7 @@ class SearchTEIViewModel( item, searchParametersModel.selectedProgram, true, - FilterManager.getInstance().sortingItem, + filterManager.sortingItem, ) } } @@ -387,20 +389,20 @@ class SearchTEIViewModel( withContext(dispatchers.io()) { if ( searching && networkUtils.isOnline() && - FilterManager.getInstance().stateFilters.isEmpty() + filterManager.stateFilters.isEmpty() ) { searchRepository.transform( item, searchParametersModel.selectedProgram, false, - FilterManager.getInstance().sortingItem, + filterManager.sortingItem, ) } else { searchRepository.transform( item, searchParametersModel.selectedProgram, true, - FilterManager.getInstance().sortingItem, + filterManager.sortingItem, ) } } @@ -893,9 +895,9 @@ class SearchTEIViewModel( /* selectedProgram = */ searchParametersModel.selectedProgram, /* offlineOnly = */ - !(isOnline && FilterManager.getInstance().stateFilters.isEmpty()), + !(isOnline && filterManager.stateFilters.isEmpty()), /* sortingItem = */ - FilterManager.getInstance().sortingItem, + filterManager.sortingItem, ) }