Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: [ANDROAPP-6209] Not filter empty program indicators #3729

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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