Skip to content

Commit

Permalink
Fixed not showing add to family planning option for patient who is al…
Browse files Browse the repository at this point in the history
…ready opt-ed in
  • Loading branch information
aurangzaibumer committed Sep 9, 2022
1 parent 4cba138 commit 9bc8b49
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ constructor(
Pair(
R.id.add_to_family_planning,
profileData?.let {
!(it.tasks.none { it.action.matches(Regex(ACTIVE_ANC_REGEX)) } && (it.dob?.yearsPassed() in 15..48))
!(it.tasks.none { it.action.matches(Regex(ACTIVE_ANC_REGEX)) } &&
it.conditions.none { it.code.text.equals("Family Planning") } &&
(it.dob?.yearsPassed() in 15..48))
}
?: false
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package org.smartregister.fhircore.quest.ui.shared.models
import java.util.Date
import org.smartregister.fhircore.engine.domain.model.ActionableButtonData
import org.smartregister.fhircore.quest.ui.family.profile.model.FamilyMemberViewState
import org.hl7.fhir.r4.model.Condition

sealed class ProfileViewData(
open val logicalId: String = "",
Expand All @@ -39,6 +40,7 @@ sealed class ProfileViewData(
val medicalHistoryData: List<PatientProfileRowItem> = emptyList(),
val upcomingServices: List<PatientProfileRowItem> = emptyList(),
val ancCardData: List<PatientProfileRowItem> = emptyList(),
val conditions: List<Condition> = listOf(),
) : ProfileViewData(name = name, logicalId = logicalId, identifier = identifier)

data class FamilyProfileViewData(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class ProfileViewDataMapper @Inject constructor(@ApplicationContext val context:
age = inputModel.age,
sex = inputModel.gender.translateGender(context),
dob = inputModel.birthdate,
conditions = inputModel.conditions,
tasks =
inputModel.tasks.take(DEFAULT_TASKS_COUNT).map {
ActionableButtonData(
Expand Down

0 comments on commit 9bc8b49

Please sign in to comment.