-
Notifications
You must be signed in to change notification settings - Fork 23
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
Conversation
There was a problem hiding this 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
...capture-core/components/DataEntry/withAskToCompleteEnrollment/withAskToCompleteEnrollment.js
Outdated
Show resolved
Hide resolved
[enrollmentSiteActionTypes.SET_EXTERNAL_ENROLLMENT_STATUS]: (state, action) => ({ | ||
status: action.payload.status, | ||
}), | ||
[enrollmentSiteActionTypes.REMOVE_EXTERNAL_ENROLLMENT_STATUS]: () => ({ status: null }), | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[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!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great suggestion, thanks!
.../EnrollmentAddEvent/EnrollmentAddEventPageDefault/EnrollmentAddEventPageDefault.container.js
Show resolved
Hide resolved
@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]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
}, [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
.../EnrollmentAddEvent/EnrollmentAddEventPageDefault/EnrollmentAddEventPageDefault.container.js
Show resolved
Hide resolved
There was a problem hiding this 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 👍
🚀 Deployed on https://deploy-preview-3535--dhis2-capture.netlify.app |
There was a problem hiding this 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
# [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))
🎉 This PR is included in version 100.60.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
DHIS2-13800
Tech summary
@dhis2/d2-i18n
translations when usingdefaultValue_plural
. Until this is resolved, I applied the same solution described in DHIS2-16591.