Skip to content

Commit

Permalink
OHRI-2095 Populate the missing appointment date on the TB dashboard s…
Browse files Browse the repository at this point in the history
…ummary (#1771)

* fix missing appointment date on TB dashboard summary

* address review comments
  • Loading branch information
kajambiya authored Jan 18, 2024
1 parent 99d5563 commit 0301a2c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ export const CohortPatientList: React.FC<CohortPatientListProps> = ({
autoFocus: true,
};
}, [
loadedExtraEncounters,
searchTerm,
filteredResults,
paginatedPatients,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ function TbHomePatientTabs() {
},
associatedEncounterType: config.encounterTypes.tbProgramEnrollment,
excludeColumns: ['timeAddedToList', 'waitingTime', 'location', 'phoneNumber', 'hivResult'],
extraAssociatedEncounterTypes: [config.encounterTypes.tbTreatmentAndFollowUp],
otherColumns: [
{
key: 'caseID',
Expand All @@ -49,8 +50,18 @@ function TbHomePatientTabs() {
{
key: 'nextAppointmentDate',
header: t('appointmentDate', 'Appointment Date'),
getValue: ({ latestEncounter }) => {
return getObsFromEncounter(latestEncounter, config.obsConcepts.nextAppointmentDate, true);
getValue: (patient) => {
const patientLatestExtraEncounters = patient.latestExtraEncounters;
if (patientLatestExtraEncounters && patientLatestExtraEncounters.length) {
const latestFollowUpEncounter = patientLatestExtraEncounters.find(
(encounter) => encounter.encounterType.uuid === config.encounterTypes.tbTreatmentAndFollowUp,
);
return latestFollowUpEncounter
? getObsFromEncounter(latestFollowUpEncounter, config.obsConcepts.nextAppointmentDate, true)
: '--';
} else {
return '--';
}
},
},
{
Expand Down

0 comments on commit 0301a2c

Please sign in to comment.