Skip to content

getEncounters doesn't sortBy cancelDateTime #44

@mahalakshme

Description

@mahalakshme

Issue:
getEncounters function in Individual.js and ProgramEnrolment.js has facility to consider cancelled encounters as well. But it is not considering cancelDateTime when sorting the encounters. Hence when need to get the latest(including cancelled encounters) another sorting as below need to be done in the report card query:

const encounters = enrolment.getEncounters(false);
      const sortedEncounters = _.sortBy(encounters, (encounter) => {
      return _.isNil(encounter.cancelDateTime)? moment().diff(encounter.encounterDateTime) : 
      moment().diff(encounter.cancelDateTime)}); 
      const latestEncounter = _.head(sortedEncounters);

Significance of fixing this issue:

  • To prevent code duplication of above in the implementations
  • For faster work in implementation team.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    In Analysis Review

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions