@@ -579,11 +579,11 @@ class PatientSummaryUpdate(
579579 ! hasAppointmentChangedSinceScreenCreated &&
580580 medicalHistory.suspected.not ()
581581
582- val hasAtLeastOneMeasurementRecorded = countOfRecordedBloodPressures + countOfRecordedBloodSugars > 0
583- val shouldShowDiagnosisError = hasAtLeastOneMeasurementRecorded && when {
584- model.isDiabetesManagementEnabled -> medicalHistory.diagnosisRecorded. not ()
585- else -> medicalHistory.hypertensionRecorded. not ()
586- }
582+ val shouldShowDiagnosisErrorForDiabetesEnabled =
583+ model.isDiabetesManagementEnabled && medicalHistory.diagnosisRecorded. not ()
584+
585+ val shouldShowHypertensionDiagnosisErrorForDiabetesDisabled =
586+ model.isDiabetesManagementEnabled. not () && medicalHistory.hypertensionRecorded. not ()
587587
588588 val measurementWarningEffect = validateMeasurements(
589589 isDiabetesManagementEnabled = model.isDiabetesManagementEnabled,
@@ -600,7 +600,8 @@ class PatientSummaryUpdate(
600600 prescribedDrugs.any { prescription -> diagnosisWarningPrescriptions.diabetesPrescriptions.contains(prescription.name.lowercase()) }
601601
602602 return when {
603- shouldShowDiagnosisError -> dispatch(ShowDiagnosisError (model.isDiabetesManagementEnabled))
603+ shouldShowDiagnosisErrorForDiabetesEnabled -> dispatch(ShowDiagnosisError )
604+ shouldShowHypertensionDiagnosisErrorForDiabetesDisabled -> dispatch(ShowHypertensionDiagnosisError )
604605 ! model.hasShownDiagnosisWarningDialog && canShowHTNDiagnosisWarning -> next(model.shownDiagnosisWarningDialog(), ShowHypertensionDiagnosisWarning (continueToDiabetesDiagnosisWarning = canShowDiabetesDiagnosisWarning))
605606 ! model.hasShownDiagnosisWarningDialog && canShowDiabetesDiagnosisWarning -> next(model.shownDiagnosisWarningDialog(), ShowDiabetesDiagnosisWarning )
606607 measurementWarningEffect != null -> next(model.shownMeasurementsWarningDialog(), setOf (measurementWarningEffect))
@@ -625,11 +626,11 @@ class PatientSummaryUpdate(
625626 && ! hasAppointmentChangedSinceScreenCreated
626627 && medicalHistory.suspected.not ()
627628
628- val hasAtLeastOneMeasurementRecorded = countOfRecordedBloodPressures + countOfRecordedBloodSugars > 0
629- val shouldShowDiagnosisError = hasAtLeastOneMeasurementRecorded && when {
630- model.isDiabetesManagementEnabled -> medicalHistory.diagnosisRecorded. not ()
631- else -> medicalHistory.hypertensionRecorded. not ()
632- }
629+ val shouldShowDiagnosisErrorForDiabetesEnabled =
630+ model.isDiabetesManagementEnabled && medicalHistory.diagnosisRecorded. not ()
631+
632+ val shouldShowHypertensionDiagnosisErrorForDiabetesDisabled =
633+ model.isDiabetesManagementEnabled. not () && medicalHistory.hypertensionRecorded. not ()
633634
634635 val openIntention = model.openIntention
635636 val shouldGoToPreviousScreen = openIntention is ViewExistingPatient
@@ -650,7 +651,8 @@ class PatientSummaryUpdate(
650651 prescribedDrugs.any { prescription -> diagnosisWarningPrescriptions.diabetesPrescriptions.contains(prescription.name.lowercase()) }
651652
652653 return when {
653- shouldShowDiagnosisError -> dispatch(ShowDiagnosisError (model.isDiabetesManagementEnabled))
654+ shouldShowDiagnosisErrorForDiabetesEnabled -> dispatch(ShowDiagnosisError )
655+ shouldShowHypertensionDiagnosisErrorForDiabetesDisabled -> dispatch(ShowHypertensionDiagnosisError )
654656 ! model.hasShownDiagnosisWarningDialog && canShowHTNDiagnosisWarning -> next(model.shownDiagnosisWarningDialog(), ShowHypertensionDiagnosisWarning (continueToDiabetesDiagnosisWarning = canShowDiabetesDiagnosisWarning))
655657 ! model.hasShownDiagnosisWarningDialog && canShowDiabetesDiagnosisWarning -> next(model.shownDiagnosisWarningDialog(), ShowDiabetesDiagnosisWarning )
656658 measurementWarningEffect != null -> next(model.shownMeasurementsWarningDialog(), setOf (measurementWarningEffect))
0 commit comments