Fix validation message for number fields to consider min and max values#2766
Fix validation message for number fields to consider min and max values#2766harshitIIITD wants to merge 1 commit intogoogle:masterfrom
Conversation
Update validation messages for number fields to consider min and max values from the questionnaire item. * Modify `EditTextDecimalViewHolderFactory.kt` to include min and max values in the validation message for decimal fields. * Modify `EditTextIntegerViewHolderFactory.kt` to include min and max values in the validation message for integer fields.
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
| val minValue = questionnaireViewItem.minAnswerValue?.toString() ?: DecimalType(Int.MIN_VALUE).toString() | ||
| val maxValue = questionnaireViewItem.maxAnswerValue?.toString() ?: DecimalType(Int.MAX_VALUE).toString() |
There was a problem hiding this comment.
If we check fhir spec about decimal. It was mentioned that the limit is 18 digit + 1 decimal point (https://build.fhir.org/datatypes.html#decimal)
So, I think we shouldn't use the max or min value of integer, as it only accepts 10 digits at most (https://build.fhir.org/datatypes.html#integer)
Also, if we check the parent class of DecimalType, it's actually BigDecimal. In Java BigDecimal doesn't really have a limit, it's constrained only by the amount of available memory.
But it's good to follow the limit set by fhir spec.
jingtang10
left a comment
There was a problem hiding this comment.
thanks for the work!
please see the comment i left in the other pr: #2763 (comment)
Update validation messages for number fields to consider min and max values from the questionnaire item.
EditTextDecimalViewHolderFactory.ktto include min and max values in the validation message for decimal fields.EditTextIntegerViewHolderFactory.ktto include min and max values in the validation message for integer fields.