Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getEncounters doesn't sortBy cancelDateTime #44

Open
mahalakshme opened this issue May 9, 2023 · 0 comments
Open

getEncounters doesn't sortBy cancelDateTime #44

mahalakshme opened this issue May 9, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@mahalakshme
Copy link
Contributor

mahalakshme commented May 9, 2023

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.
@mahalakshme mahalakshme added the bug Something isn't working label May 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: In Analysis Review
Development

No branches or pull requests

2 participants