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

(fix) O3-2655: Record Vitals: Error message for invalid values pops up only once #1578

Merged
merged 2 commits into from
Jan 15, 2024

Conversation

psworld
Copy link
Contributor

@psworld psworld commented Jan 10, 2024

Requirements

  • My work includes tests or is validated by existing tests.

Summary

There were two issue:

  1. When an invalid value for vitals was entered e.g 400 beats per minute, which is physiologically not possible, the input field did not show the error and the valid range. An argument showErrorMessage was missing from <VitalsAndBiometricsInput /> component.
  2. When we save the form with invalid values an inline notification pops up. If after closing the inline notification we again try to save the form with invalid values no notification pops up. This happened because state variable hasInvalidVitals did not change when we again pressed the save form button and hence no re-render was triggered. To fix it, I set the onClose property on the <InlineNotification /> to setHasInvalidVitals(false). This make sure that the re-render occur when I again press the submit button.

Screenshots

Input field validation

Before

No input field error is shown when Blood pressure and Heart rate have invalid values.

image

After

image

Inline Notification

Before

Untitled.video.-.Made.with.Clipchamp.mp4

After

Untitled.video.-.Made.with.Clipchamp.2.mp4

Related Issue

Link to JIRA ticket: https://openmrs.atlassian.net/browse/O3-2655

@psworld psworld force-pushed the O3-2655 branch 2 times, most recently from 1a0e51d to 1b87ca0 Compare January 11, 2024 12:35
@psworld
Copy link
Contributor Author

psworld commented Jan 11, 2024

@denniskigen Hello Sir,

Could you please review my PR ?
If any more changes are required please let me know

Copy link
Member

@denniskigen denniskigen left a comment

Choose a reason for hiding this comment

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

Nice work, @usamaidrsk. Could you add a test?

@usamaidrsk
Copy link
Contributor

Nice work, @usamaidrsk. Could you add a test?

I think that's @psworld .
Thanks

@psworld
Copy link
Contributor Author

psworld commented Jan 13, 2024

Nice work, @usamaidrsk. Could you add a test?

Thanks.
I will try to add tests as soon as I can.

@psworld
Copy link
Contributor Author

psworld commented Jan 14, 2024

Hello @denniskigen ,
I have added the tests. Kindly review the changes. Following is description of tests added:

Tests added:

  1. Vitals and Biometrics input test :
    It checks for the Invalid Vitals error message. If you add vitals value outside of the reference range, you get an error saying Value must be between min and max. The added test check for presence of this text on screen.

  2. Inline Error notification test :
    This test checks for the presence of inline error notification when you try to submit Vitals and Biometrics with invalid values (Values outside of reference range) and test if the inline error notification pop up again after closing the notification and resubmitting the form.

If there are any changes required, please let me know

@denniskigen
Copy link
Member

Excellent work! Thanks, @psworld!

@denniskigen denniskigen merged commit 7e05168 into openmrs:main Jan 15, 2024
6 checks passed
@psworld
Copy link
Contributor Author

psworld commented Jan 15, 2024

Excellent work! Thanks, @psworld!

Thankyou so much. It means a lot to me 🙏

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