Skip to content

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

@mahalakshme

Description

@mahalakshme

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:

  • This is to prevent missing out checking voided or if the program is exited in rules/report card queries
  • To keep the code in rules and report card queries more concise.
  • Currently the method isActive available doesn't do all the checks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Ready

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions