Skip to content

Commit

Permalink
Merge pull request #71 from icrc-jofrancisco/filter-encounters-list
Browse files Browse the repository at this point in the history
(chore) Filter encounters list to not display visits and prevent splash screen return
  • Loading branch information
icrc-psousa authored Oct 7, 2024
2 parents e59b605 + 1524abb commit ef79d3e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ class SplashActivity : AppCompatActivity() {
} else {
startActivity(Intent(this, LoginActivity::class.java))
}

finish()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import org.hl7.fhir.r4.model.ResourceType
import org.openmrs.android.fhir.MockConstants
import org.openmrs.android.fhir.R
import org.openmrs.android.fhir.MockConstants.DATE24_FORMATTER
import org.openmrs.android.fhir.MockConstants.WRAP_ENCOUNTER
import org.openmrs.android.helpers.OpenMRSHelper
import java.text.SimpleDateFormat
import java.util.Date
Expand Down Expand Up @@ -70,7 +71,11 @@ class PatientDetailsViewModel(
data.addPatientDetailData(patientResource)
data.add(PatientDetailHeader(getString(R.string.header_encounters)))
visits.forEach { (visit, encounters) ->
data.addVisitData(visit, encounters)

if (!WRAP_ENCOUNTER) {
data.addVisitData(visit, encounters)
}

encounters.forEach { encounter ->
data.addEncounterData(encounter)
}
Expand All @@ -86,10 +91,11 @@ class PatientDetailsViewModel(
.toPatientItem(0)
.let { patientItem ->
runBlocking {
patientItem.isSynced = fhirEngine.getLocalChanges(ResourceType.Patient, patientItem.resourceId).isEmpty()
patientItem.isSynced =
fhirEngine.getLocalChanges(ResourceType.Patient, patientItem.resourceId).isEmpty()
add(PatientDetailOverview(patientItem, firstInGroup = true))
if(patientItem.isSynced !=null && !patientItem.isSynced!!){
add(PatientUnsynced(false,false))
if (patientItem.isSynced != null && !patientItem.isSynced!!) {
add(PatientUnsynced(false, false))
}
}
// Add other patient details if necessary
Expand Down Expand Up @@ -183,7 +189,7 @@ data class PatientDetailOverview(
data class PatientUnsynced(
override val firstInGroup: Boolean = false,
override val lastInGroup: Boolean = false
):PatientDetailData
) : PatientDetailData

data class PatientDetailObservation(
val observation: PatientListViewModel.ObservationItem,
Expand Down

0 comments on commit ef79d3e

Please sign in to comment.