Skip to content

Commit

Permalink
fix: [ANDROAPP-6209] Not filter empty program indicators (#3729)
Browse files Browse the repository at this point in the history
* fix: [ANDROAPP-6209] Don't filter empty program indicators

Signed-off-by: andresmr <[email protected]>

* fix: [ANDROAPP-6209] replace deprecated indicators

* fix: [ANDROAPP-6209] lint

* test: [ANDROAPP-6209] Remove unnecessary assertion in shouldSuccessfullySearchAndFilter test

Signed-off-by: andresmr <[email protected]>

---------

Signed-off-by: andresmr <[email protected]>
Co-authored-by: Xavier Molloy <[email protected]>
  • Loading branch information
andresmr and xavimolloy authored Jul 17, 2024
1 parent 0afb24c commit 6683176
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,6 @@ class SearchTETest : BaseTest() {
checkFilterCounter(totalCount)
checkCountAtFilter(enrollmentStatus, totalFilterCount)
clickOnFilter()
checkTEIsAreOpen()
}

searchTeiRobot(composeTestRule) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@ import androidx.test.espresso.action.ViewActions.click
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.contrib.PickerActions
import androidx.test.espresso.contrib.RecyclerViewActions.actionOnItem
import androidx.test.espresso.matcher.ViewMatchers
import androidx.test.espresso.matcher.ViewMatchers.hasDescendant
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
import androidx.test.espresso.matcher.ViewMatchers.withChild
import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.espresso.matcher.ViewMatchers.withParent
import androidx.test.espresso.matcher.ViewMatchers.withText
Expand All @@ -33,16 +31,6 @@ fun filterRobot(filterRobot: FilterRobot.() -> Unit) {

class FilterRobot : BaseRobot() {

fun clickOnEnrollmentDateFilter() {
val tag = "DATE OF ENROLLMENT"
onView(allOf(withId(R.id.filterLayout), hasDescendant(withText(tag)))).perform(click())
}

fun clickOnTodayEnrollmentDate(){
onView(allOf(withId(R.id.today),
withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))).perform(click())
}

fun clickOnFilter() {
onView(withId(R.id.search_filter_general)).perform(click())
}
Expand All @@ -68,10 +56,6 @@ class FilterRobot : BaseRobot() {
.perform(actionOnItem<FilterHolder>(hasDescendant(withText(filter)), clickChildViewWithId(R.id.filterArrow)))
}

fun closeSearchForm() {
onView(withId(R.id.close_filter)).perform(click())
}

fun clickOnSortByField(fieldFilter: String) {
onView(withId(R.id.filterRecyclerLayout))
.perform(actionOnItem<FilterHolder>(hasDescendant(withText(fieldFilter)), clickChildViewWithId(R.id.sortingIcon)))
Expand Down Expand Up @@ -102,11 +86,6 @@ class FilterRobot : BaseRobot() {
.check(matches(allElementsWithHolderTypeHave(SearchTEViewHolder::class.java,hasDescendant(withText(R.string.event_open)))))
}

fun checkEventsAreOverdue() {
onView(withId(R.id.scrollView))
.check(matches(allOf(allElementsWithHolderTypeHave(SearchTEViewHolder::class.java,hasDescendant(withId(R.id.overdueIcon))), isDisplayed())))
}

fun checkTEIWithOrgUnit(orgUnit: String) {
onView(withId(R.id.scrollView))
.check(matches(allElementsWithHolderTypeHave(SearchTEViewHolder::class.java,hasDescendant(withText(orgUnit)))))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ abstract class BaseIndicatorRepository(
null
}
Pair.create(indicator, indicatorValue ?: "")
}.filter { it.val1().isNotEmpty() }
.flatMap {
}.flatMap {
getLegendColorForIndicator(it.val0(), it.val1())
}.map {
IndicatorModel(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import androidx.compose.ui.unit.dp
import dhis2.org.R
import dhis2.org.analytics.charts.data.ChartType
import dhis2.org.analytics.charts.data.Graph
import org.hisp.dhis.mobile.ui.designsystem.component.IndicatorInput
import org.hisp.dhis.mobile.ui.designsystem.component.Indicator
import org.hisp.dhis.mobile.ui.designsystem.theme.DHIS2Theme
import org.hisp.dhis.mobile.ui.designsystem.theme.SurfaceColor

Expand All @@ -37,7 +37,7 @@ class GraphToIndicator {
) {
series.forEach {
val coordinate = it.coordinates.lastOrNull()
IndicatorInput(
Indicator(
title = it.fieldName,
content = it.coordinates.lastOrNull()?.textValue() ?: "",
indicatorColor = if (coordinate?.legendValue?.color != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import androidx.recyclerview.widget.RecyclerView
import dhis2.org.R
import org.dhis2.commons.dialogs.CustomDialog
import org.hisp.dhis.android.core.program.ProgramIndicator
import org.hisp.dhis.mobile.ui.designsystem.component.IndicatorInput
import org.hisp.dhis.mobile.ui.designsystem.component.Indicator
import org.hisp.dhis.mobile.ui.designsystem.theme.SurfaceColor

class IndicatorViewHolder(
Expand Down Expand Up @@ -47,7 +47,7 @@ class IndicatorViewHolder(
},
),
) {
IndicatorInput(
Indicator(
title = programIndicatorModel.label(),
indicatorColor = if (!programIndicatorModel.color.isNullOrEmpty()) {
Color(programIndicatorModel.color())
Expand Down

0 comments on commit 6683176

Please sign in to comment.