Skip to content

Commit

Permalink
POC-105: Fix Bug Under Group Manager Landing Page After filling Medic…
Browse files Browse the repository at this point in the history
…ation Refill Form (AMPATH#1553)

Co-authored-by: Kipchumba C. Bett <[email protected]>
  • Loading branch information
2 people authored and hiqedme committed Apr 4, 2023
1 parent 9f76724 commit 5ea4aef
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/app/group-manager/group-detail/group-detail.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,12 +379,33 @@ export class GroupDetailComponent implements OnInit, OnDestroy, AfterViewInit {
}
}

checkIfDrugPickupFilled(cohortVisit, patient) {
let xx = false;
const drugPickupUuid = '987009c6-6f24-43f7-9640-c285d6553c63';

cohortVisit.cohortMemberVisits.filter((cmv) => {
if (cmv.visit.patient.uuid === patient.person.uuid) {
cmv.visit.encounters.forEach((en) => {
if (
en.encounterType.uuid === drugPickupUuid &&
Moment(cmv.visit.startDatetime).format('DD MMMM YYYY') ===
Moment(en.encounterDatetime).format('DD MMMM YYYY')
) {
xx = true;
}
});
}
});

return xx;
}

private patientPresent(patient, cohortVisit) {
let present = false;
const patientVisit = cohortVisit.cohortMemberVisits.find((v) => {
return v.visit.patient.uuid === patient.person.uuid;
});
if (patientVisit) {
if (patientVisit && this.checkIfDrugPickupFilled(patient, cohortVisit)) {
present = true;
}
return present;
Expand Down

0 comments on commit 5ea4aef

Please sign in to comment.