diff --git a/app/src/main/java/org/dhis2/usescases/teiDashboard/DashboardProgramModel.kt b/app/src/main/java/org/dhis2/usescases/teiDashboard/DashboardProgramModel.kt index cb2e20440a..57393ff42b 100644 --- a/app/src/main/java/org/dhis2/usescases/teiDashboard/DashboardProgramModel.kt +++ b/app/src/main/java/org/dhis2/usescases/teiDashboard/DashboardProgramModel.kt @@ -3,7 +3,6 @@ package org.dhis2.usescases.teiDashboard import org.dhis2.ui.MetadataIconData import org.hisp.dhis.android.core.enrollment.Enrollment import org.hisp.dhis.android.core.enrollment.EnrollmentStatus -import org.hisp.dhis.android.core.event.Event import org.hisp.dhis.android.core.organisationunit.OrganisationUnit import org.hisp.dhis.android.core.program.Program import org.hisp.dhis.android.core.program.ProgramStage @@ -31,7 +30,6 @@ sealed class DashboardModel( data class DashboardEnrollmentModel( val currentEnrollment: Enrollment, val programStages: List, - val eventModels: List, override val trackedEntityInstance: TrackedEntityInstance, val trackedEntityAttributes: List>, override val trackedEntityAttributeValues: List, diff --git a/app/src/main/java/org/dhis2/usescases/teiDashboard/DashboardRepository.kt b/app/src/main/java/org/dhis2/usescases/teiDashboard/DashboardRepository.kt index f8905414a4..e6d6353c20 100644 --- a/app/src/main/java/org/dhis2/usescases/teiDashboard/DashboardRepository.kt +++ b/app/src/main/java/org/dhis2/usescases/teiDashboard/DashboardRepository.kt @@ -29,8 +29,6 @@ interface DashboardRepository { fun getEnrollment(): Observable - fun getTEIEnrollmentEvents(programUid: String?, teiUid: String): Observable> - fun getEnrollmentEventsWithDisplay( programUid: String?, teiUid: String, diff --git a/app/src/main/java/org/dhis2/usescases/teiDashboard/DashboardRepositoryImpl.kt b/app/src/main/java/org/dhis2/usescases/teiDashboard/DashboardRepositoryImpl.kt index 9700c6d1c8..a123aa9781 100644 --- a/app/src/main/java/org/dhis2/usescases/teiDashboard/DashboardRepositoryImpl.kt +++ b/app/src/main/java/org/dhis2/usescases/teiDashboard/DashboardRepositoryImpl.kt @@ -12,7 +12,6 @@ import org.dhis2.commons.prefs.Preference import org.dhis2.commons.prefs.PreferenceProvider import org.dhis2.commons.resources.MetadataIconProvider import org.dhis2.ui.MetadataIconData -import org.dhis2.utils.DateUtils import org.dhis2.utils.ValueUtils import org.hisp.dhis.android.core.D2 import org.hisp.dhis.android.core.arch.helpers.UidsHelper.getUidsList @@ -68,30 +67,6 @@ class DashboardRepositoryImpl( .toObservable() } - override fun getTEIEnrollmentEvents( - programUid: String?, - teiUid: String, - ): Observable> { - return d2.eventModule().events().byEnrollmentUid().eq(enrollmentUid) - .byDeleted().isFalse - .orderByTimeline(RepositoryScope.OrderByDirection.ASC) - .get().toFlowable().flatMapIterable { events: List? -> events }.distinct() - .map { event: Event -> - var event = event - if (java.lang.Boolean.FALSE - == d2.programModule().programs().uid(programUid).blockingGet()!! - .ignoreOverdueEvents() - ) if (event.status() == EventStatus.SCHEDULE && - event.dueDate()!! - .before(DateUtils.getInstance().today) - ) { - event = updateState(event, EventStatus.OVERDUE) - } - event - }.toList() - .toObservable() - } - override fun getEnrollmentEventsWithDisplay( programUid: String?, teiUid: String, @@ -388,7 +363,6 @@ class DashboardRepositoryImpl( DashboardEnrollmentModel( getEnrollment().blockingFirst(), getProgramStages(programUid).blockingFirst(), - getTEIEnrollmentEvents(programUid, teiUid).blockingFirst(), getTrackedEntityInstance(teiUid).blockingFirst(), getAttributesMap(programUid, teiUid).blockingFirst(), getTEIAttributeValues(programUid, teiUid).blockingFirst(), diff --git a/app/src/main/java/org/dhis2/usescases/teiDashboard/dashboardfragments/teidata/TEIDataPresenter.kt b/app/src/main/java/org/dhis2/usescases/teiDashboard/dashboardfragments/teidata/TEIDataPresenter.kt index 84dd97073a..72ccbcdfbd 100644 --- a/app/src/main/java/org/dhis2/usescases/teiDashboard/dashboardfragments/teidata/TEIDataPresenter.kt +++ b/app/src/main/java/org/dhis2/usescases/teiDashboard/dashboardfragments/teidata/TEIDataPresenter.kt @@ -9,7 +9,6 @@ import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import io.reactivex.Completable import io.reactivex.Flowable -import io.reactivex.Observable import io.reactivex.disposables.CompositeDisposable import io.reactivex.processors.BehaviorProcessor import kotlinx.coroutines.CoroutineScope @@ -197,32 +196,6 @@ class TEIDataPresenter( dashboardRepository.saveCatOption(eventUid, catOptionComboUid) } - fun areEventsCompleted() { - compositeDisposable.add( - dashboardRepository.getEnrollmentEventsWithDisplay(programUid, teiUid) - .flatMap { events -> - if (events.isEmpty()) { - dashboardRepository.getTEIEnrollmentEvents( - programUid, - teiUid, - ) - } else { - Observable.just(events) - } - } - .map { events -> - Observable.fromIterable(events) - .all { event -> event.status() == EventStatus.COMPLETED } - } - .subscribeOn(schedulerProvider.io()) - .observeOn(schedulerProvider.ui()) - .subscribe( - view.areEventsCompleted(), - Timber.Forest::d, - ), - ) - } - fun displayGenerateEvent(eventUid: String?) { compositeDisposable.add( dashboardRepository.displayGenerateEvent(eventUid) diff --git a/app/src/test/java/org/dhis2/usescases/teiDashboard/TeiDashboardPresenterTest.kt b/app/src/test/java/org/dhis2/usescases/teiDashboard/TeiDashboardPresenterTest.kt index f781a95e01..8d7e18bded 100644 --- a/app/src/test/java/org/dhis2/usescases/teiDashboard/TeiDashboardPresenterTest.kt +++ b/app/src/test/java/org/dhis2/usescases/teiDashboard/TeiDashboardPresenterTest.kt @@ -14,7 +14,6 @@ import org.dhis2.utils.analytics.CLICK import org.dhis2.utils.analytics.DELETE_TEI import org.hisp.dhis.android.core.enrollment.Enrollment import org.hisp.dhis.android.core.enrollment.EnrollmentStatus -import org.hisp.dhis.android.core.event.Event import org.hisp.dhis.android.core.organisationunit.OrganisationUnit import org.hisp.dhis.android.core.program.Program import org.hisp.dhis.android.core.program.ProgramStage @@ -70,7 +69,6 @@ class TeiDashboardPresenterTest { val trackedEntityInstance = TrackedEntityInstance.builder().uid(teiUid).build() val enrollment = Enrollment.builder().uid("enrollmentUid").build() val programStages = listOf(ProgramStage.builder().uid("programStageUid").build()) - val events = listOf(Event.builder().uid("eventUid").build()) val trackedEntityAttributes = listOf( Pair( TrackedEntityAttribute.builder().uid("teiAttr").build(), @@ -95,9 +93,6 @@ class TeiDashboardPresenterTest { whenever( repository.getProgramStages(programUid), ) doReturn Observable.just(programStages) - whenever( - repository.getTEIEnrollmentEvents(programUid, teiUid), - ) doReturn Observable.just(events) whenever( repository.getAttributesMap(programUid, teiUid), ) doReturn Observable.just(trackedEntityAttributes) diff --git a/app/src/test/java/org/dhis2/usescases/teiDashboard/ui/mapper/InfoBarMapperTest.kt b/app/src/test/java/org/dhis2/usescases/teiDashboard/ui/mapper/InfoBarMapperTest.kt index 0c53970687..144eea5fef 100644 --- a/app/src/test/java/org/dhis2/usescases/teiDashboard/ui/mapper/InfoBarMapperTest.kt +++ b/app/src/test/java/org/dhis2/usescases/teiDashboard/ui/mapper/InfoBarMapperTest.kt @@ -8,7 +8,6 @@ import org.dhis2.usescases.teiDashboard.ui.model.InfoBarType import org.hisp.dhis.android.core.common.State import org.hisp.dhis.android.core.enrollment.Enrollment import org.hisp.dhis.android.core.enrollment.EnrollmentStatus -import org.hisp.dhis.android.core.event.Event import org.hisp.dhis.android.core.organisationunit.OrganisationUnit import org.hisp.dhis.android.core.program.Program import org.hisp.dhis.android.core.program.ProgramStage @@ -108,7 +107,6 @@ class InfoBarMapperTest { val model = DashboardEnrollmentModel( setEnrollment(state, status, followup), emptyList(), - emptyList(), setTei(state), attributeValues, emptyList(), diff --git a/app/src/test/java/org/dhis2/usescases/teiDashboard/ui/mapper/TEIDetailMapperTest.kt b/app/src/test/java/org/dhis2/usescases/teiDashboard/ui/mapper/TEIDetailMapperTest.kt index dfd0c76782..ed304e65f3 100644 --- a/app/src/test/java/org/dhis2/usescases/teiDashboard/ui/mapper/TEIDetailMapperTest.kt +++ b/app/src/test/java/org/dhis2/usescases/teiDashboard/ui/mapper/TEIDetailMapperTest.kt @@ -7,7 +7,6 @@ import org.dhis2.usescases.teiDashboard.DashboardEnrollmentModel import org.hisp.dhis.android.core.common.State import org.hisp.dhis.android.core.enrollment.Enrollment import org.hisp.dhis.android.core.enrollment.EnrollmentStatus -import org.hisp.dhis.android.core.event.Event import org.hisp.dhis.android.core.organisationunit.OrganisationUnit import org.hisp.dhis.android.core.program.Program import org.hisp.dhis.android.core.program.ProgramStage @@ -61,7 +60,6 @@ class TEIDetailMapperTest { val model = DashboardEnrollmentModel( setEnrollment(), emptyList(), - emptyList(), setTei(), attributeValues, emptyList(),