Skip to content

Commit

Permalink
Fix return logs setup single volume validation (#1689)
Browse files Browse the repository at this point in the history
https://eaflood.atlassian.net/browse/WATER-4852

While testing for the above ticket, it was noticed that the single volume page didn't allow a user to enter a number less than 1 and validate it. If a user enters 0.5, then this should be accepted. This PR updates the validation to only allow positive numbers, thus removing the need for a min volume.
  • Loading branch information
Beckyrose200 authored Feb 6, 2025
1 parent c43fd92 commit 26c1fd5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/validators/return-logs/setup/single-volume.validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ function go(payload) {
'any.only': singleVolumeError,
'string.empty': singleVolumeError
}),
singleVolumeQuantity: Joi.number().min(1).when('singleVolume', { is: 'yes', then: Joi.required() }).messages({
singleVolumeQuantity: Joi.number().positive().when('singleVolume', { is: 'yes', then: Joi.required() }).messages({
'any.required': singleVolumeQuantityError,
'number.base': singleVolumeQuantityError,
'number.min': singleVolumeQuantityError,
'number.max': singleVolumeQuantityError,
'number.unsafe': singleVolumeQuantityError
'number.unsafe': singleVolumeQuantityError,
'number.positive': singleVolumeQuantityError
})
})

Expand Down

0 comments on commit 26c1fd5

Please sign in to comment.