-
Notifications
You must be signed in to change notification settings - Fork 296
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
Include min and max values in the validation message in a number question if the values are in the extension #2763
base: master
Are you sure you want to change the base?
Conversation
…tion if the values are in the extension
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.
Thanks for the PR!
...java/com/google/android/fhir/datacapture/views/factories/EditTextIntegerViewHolderFactory.kt
Outdated
Show resolved
Hide resolved
|
||
val minValue = | ||
(questionnaireViewItem.minAnswerValue as? IntegerType)?.value ?: Int.MIN_VALUE | ||
val maxValue = | ||
(questionnaireViewItem.maxAnswerValue as? IntegerType)?.value ?: Int.MAX_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.
what happens when the minValue is bigger than the maxValue?
how about we throw an exception when that happens?
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.
I added the exception. UI will crash when minValue > maxValue, like the slider and date widgets.
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.
Thanks for adding this. I'm ok with this PR.
Fikri's point is a good one - we do throw exceptions in other widgets when min value > max value. But I'm a bit concerned about the UI crasing... I wonder if we actually should remove that exception from the date and slider widgets.
But I'm open-minded in this case. I'll approve this PR - but pls resolve the exception question with fikri - and we can then merge this pr.
Thanks again for this - good work!
IMPORTANT: All PRs must be linked to an issue (except for extremely trivial and straightforward changes).
Fixes #2757
Description
Show
number must be between <INT_MIN> and <INT_MAX>
when input is not an integer.Use the max and min values in the extension if they are defined.
Alternative(s) considered
Have you considered any alternatives? And if so, why have you chosen the approach in this PR?
Type
Choose one: Bug fix
Screenshots (if applicable)
Screen_recording_20250101_225054.webm
Checklist
./gradlew spotlessApply
and./gradlew spotlessCheck
to check my code follows the style guide of this project../gradlew check
and./gradlew connectedCheck
to test my changes locally.