Skip to content

Commit

Permalink
Exclude the patient from their own children list
Browse files Browse the repository at this point in the history
  • Loading branch information
lucyjemutai committed Oct 28, 2024
1 parent 527b2a9 commit 58a5de2
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,15 @@ export const usePatientFamilyNames = (patientUuid: string) => {
}

const childRelationships = relationships
.filter((relationship) => relationship.relationshipType?.displayBIsToA === 'Child')
.filter(
(relationship) =>
relationship.relationshipType?.displayBIsToA === 'Child' && relationship.personB?.uuid !== patientUuid,
)
.map((relationship) => relationship.personB?.display);

setChildrenNames(childRelationships);

// Find the mother relationship
const motherRelationship = relationships.find(
(relationship) =>
(relationship.relationshipType?.displayAIsToB === 'Mother' ||
Expand Down

0 comments on commit 58a5de2

Please sign in to comment.