Skip to content

Commit

Permalink
latest ptrackerId search
Browse files Browse the repository at this point in the history
  • Loading branch information
lucyjemutai committed May 24, 2024
1 parent b759a90 commit a993f19
Showing 1 changed file with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,10 @@ const MaternalSummary: React.FC<PatientChartProps> = ({ patientUuid }) => {

useEffect(() => {
if (patient) {
const identifiers = patient.identifier;
let pTrackerIdentifier;

for (let i = identifiers.length - 1; i >= 0; i--) {
if (identifiers[i].type.coding[0].code === identifiersTypes.ptrackerIdentifierType) {
pTrackerIdentifier = identifiers[i];
break;
}
}
const reversedIdentifiers = patient.identifier.slice().reverse();
const pTrackerIdentifier = reversedIdentifiers.find((identifier) => {
return identifier.type.coding[0].code === identifiersTypes.ptrackerIdentifierType;
});

if (pTrackerIdentifier) {
setPtrackerId(pTrackerIdentifier.value);
Expand Down

0 comments on commit a993f19

Please sign in to comment.