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

feat: [DHIS2-13800] ask user to complete enrollment and events #3535

Merged
merged 13 commits into from
Mar 5, 2024

Conversation

simonadomnisoru
Copy link
Contributor

@simonadomnisoru simonadomnisoru commented Feb 23, 2024

DHIS2-13800

Tech summary

  • most architectural patterns and decisions are summarized in the ticket technical design doc.
  • there is a issue with @dhis2/d2-i18n translations when using defaultValue_plural. Until this is resolved, I applied the same solution described in DHIS2-16591.

@simonadomnisoru simonadomnisoru changed the title feat: ask user to complete enrollment and events feat: [DHIS2-13800] ask user to complete enrollment and events Feb 23, 2024
Copy link
Member

@JoakimSM JoakimSM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good @simonadomnisoru! Some comments/questions

Comment on lines 7 to 11
[enrollmentSiteActionTypes.SET_EXTERNAL_ENROLLMENT_STATUS]: (state, action) => ({
status: action.payload.status,
}),
[enrollmentSiteActionTypes.REMOVE_EXTERNAL_ENROLLMENT_STATUS]: () => ({ status: null }),
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[enrollmentSiteActionTypes.SET_EXTERNAL_ENROLLMENT_STATUS]: (state, action) => ({
status: action.payload.status,
}),
[enrollmentSiteActionTypes.REMOVE_EXTERNAL_ENROLLMENT_STATUS]: () => ({ status: null }),
},
[enrollmentSiteActionTypes.SET_EXTERNAL_ENROLLMENT_STATUS]: (state, action) => ({
status: { value: action.payload.status },
}),
},

If we do it like this, I believe we don't ever have to bother with removing the status (i.e., we won't have to dispatch REMOVE_EXTERNAL_ENROLLMENT_STATUS). You will have to do a minor change in the useEffect in useEnrollment. But this simplifies the code quite a bit!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great suggestion, thanks!

@simonadomnisoru
Copy link
Contributor Author

Looks good @simonadomnisoru! Some comments/questions

@JoakimSM, I made the changes you suggested. Let me know if you find any other problems. Thanks!

if (externalData?.status?.value) {
setEnrollment(e => ({ ...e, status: externalData?.status?.value }));
}
}, [setEnrollment, externalData?.status?.value]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}, [setEnrollment, externalData?.status?.value]);
}, [setEnrollment, externalData?.status]);

To make sure this useEffect is always triggered when we set the status we should use the object reference instead of the actual value

Copy link
Member

@JoakimSM JoakimSM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix the last one and I will approve 👍

Copy link

github-actions bot commented Mar 1, 2024

@simonadomnisoru simonadomnisoru requested review from a team as code owners March 5, 2024 07:21
Copy link

@geethaalwan geethaalwan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested successfully on 2.41 ,2.40.4 ,2.39.6,2.38.7 versions

@simonadomnisoru simonadomnisoru merged commit fd1863d into master Mar 5, 2024
36 of 37 checks passed
@simonadomnisoru simonadomnisoru deleted the DHIS2-13800 branch March 5, 2024 10:19
dhis2-bot added a commit that referenced this pull request Mar 5, 2024
# [100.60.0](v100.59.0...v100.60.0) (2024-03-05)

### Features

* [DHIS2-13800] ask user to complete enrollment and events ([#3535](#3535)) ([fd1863d](fd1863d))
@dhis2-bot
Copy link
Contributor

🎉 This PR is included in version 100.60.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants