-
Notifications
You must be signed in to change notification settings - Fork 99
(feat) O3-4171 : Validate concept answers and show error for non-existing answers #445
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
base: main
Are you sure you want to change the base?
Conversation
Hey @NethmiRodrigo should i stick with this endpoint |
setInvalidAnswerFound(!allValid); | ||
}; | ||
|
||
validateAnswers(); |
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.
Since you are calling this function inside useEffect, the function should be defined outside the useEffect
hook.
if (originalAnswerIds.has(answer.id)) { | ||
continue; | ||
} else { | ||
const url = `${restBaseUrl}/concept/${answer.id}?v=full`; |
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.
Please use the useConceptId
hook.
For future reference, we don't usually do API calls within the component like this. We make hooks - https://o3-docs.openmrs.org/docs/coding-conventions/data-fetching.
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.
@NethmiRodrigo But we can't directly use the hook inside the loop right??
{invalidAnswerFound && ( | ||
<InlineNotification | ||
kind="error" | ||
lowContrast | ||
className={styles.error} | ||
title={t('invalidAnswerConcept', 'Invalid Answer Concept Detected')} | ||
subtitle={t('answerConceptValidation', 'One or more selected answer concepts do not exist in the system. ')} | ||
/> | ||
)} |
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.
This is good, maybe we can show a not found icon within the blue tag of the answer that is invalid. Otherwise we'd have to guess which ones are invalid.
Requirements
Summary
Screenshots
Screen.Recording.2025-04-08.190713.mp4
Related Issue
https://openmrs.atlassian.net/browse/O3-4171
Other