avniproject / avni-models

Avni data model to be used by front end clients
https://avniproject.org
GNU Affero General Public License v3.0
1 stars 4 forks source link

Add method in models to check for active program enrolment #46

Open mahalakshme opened 1 year ago

mahalakshme commented 1 year ago

Usecase: Currently when I want to check when an individual is actively enrolled in a program(say Child program) in say, in report card query, I need to do the below: enrolment.program.name === 'Child' && _.isNil(enrolment.programExitDateTime) && !enrolment.voided

Instead I would like to have a method, in models like below:

const isActive = (programName) => {
return this.program.name === programName && _.isNil(this.programExitDateTime) && !this.voided
}

Need: