From f26ca4e533ac2b1fbf530e15d34d2137b51f42d9 Mon Sep 17 00:00:00 2001 From: Vivek Singh Date: Thu, 28 Dec 2023 11:44:32 +0530 Subject: [PATCH] avniproject/avni-client#1253 - added missing method that got deleted during commit review --- src/ProgramEnrolment.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/ProgramEnrolment.js b/src/ProgramEnrolment.js index 2008582..4ffe5db 100644 --- a/src/ProgramEnrolment.js +++ b/src/ProgramEnrolment.js @@ -622,6 +622,13 @@ class ProgramEnrolment extends BaseEntity { ); } + everScheduledEncounters() { + return _.filter( + this.getEncounters(true), + (encounter) => !_.isNil(encounter.earliestVisitDateTime) && _.isNil(encounter.cancelDateTime) + ); + } + scheduledEncountersOfType(encounterTypeName) { return this.scheduledEncounters().filter( (scheduledEncounter) => scheduledEncounter.encounterType.name === encounterTypeName