Skip to content

Commit

Permalink
Adjusted AttendanceTable rendering to prevent undefined patient issues
Browse files Browse the repository at this point in the history
  • Loading branch information
icrc-psousa committed Mar 27, 2024
1 parent b743382 commit 2711866
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/group-form-entry-workflow/attendance-table/AttendanceTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,17 @@ const AttendanceTable = ({ patients }) => {
</TableHead>
<TableBody>
{activeGroupMembers
.map((patientUuid, index) => {
return patients.find((patient) => patient.id === patientUuid);
})
.sort((a, b) => {
return getPatientName(a).localeCompare(getPatientName(b));
})
.map((patient, index) => {
return <PatientRow patient={patient} key={index} />;
})}
.map((patientUuid) =>
patients.find((patient) => patient.id === patientUuid)
)
.filter(Boolean)
.sort((a, b) =>
getPatientName(a).localeCompare(
getPatientName(b).map((patient, index) => (
<PatientRow patient={patient} key={index} />
))
)
)}
</TableBody>
</Table>
</div>
Expand Down

0 comments on commit 2711866

Please sign in to comment.