Skip to content

Commit

Permalink
Fix statin nudge not getting dismissed when a statin is added (#5082)
Browse files Browse the repository at this point in the history
  • Loading branch information
msasikanth authored Sep 13, 2024
1 parent a454d92 commit 801fd5b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
- Bump AndroidX Lifecycle to v2.8.5
- Check statin nudge status in patient summary screen
- Add feature flag for statin nudge
- Fix statin nudge not getting dismissed when a statin is added

### Features

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,18 @@ class PatientSummaryEffectHandler @AssistedInject constructor(
Pair(patient, it)
}
}
.map { (patient, hasBPRecordedToday) ->
.flatMap { (patient, hasBPRecordedToday) ->
val prescriptionsObservable = prescriptionRepository.newestPrescriptionsForPatient(patient.uuid)
prescriptionsObservable.map { prescriptions ->
Triple(patient, prescriptions, hasBPRecordedToday)
}
}
.map { (patient, prescriptions, hasBPRecordedToday) ->
val assignedFacility = getAssignedFacility(patient.assignedFacilityId).toNullable()
val medicalHistory = medicalHistoryRepository.historyForPatientOrDefaultImmediate(
defaultHistoryUuid = uuidGenerator.v4(),
patientUuid = patient.uuid
)
val prescriptions = prescriptionRepository.newestPrescriptionsForPatientImmediate(patient.uuid)

StatinPrescriptionCheckInfoLoaded(
age = patient.ageDetails.estimateAge(userClock = userClock),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,7 @@ class PatientSummaryEffectHandlerTest {
patientUuid = patientUuid,
defaultHistoryUuid = uuidGenerator.v4()
)) doReturn medicalHistory
whenever(prescriptionRepository.newestPrescriptionsForPatientImmediate(patientUuid)) doReturn emptyList()
whenever(prescriptionRepository.newestPrescriptionsForPatient(patientUuid)) doReturn Observable.just(emptyList())

// when
testCase.dispatch(LoadStatinPrescriptionCheckInfo(patient))
Expand Down

0 comments on commit 801fd5b

Please sign in to comment.