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 regex validation in Product type for fields that specify USD #446

Merged
merged 1 commit into from
Aug 27, 2020

Conversation

miguelsorianod
Copy link
Contributor

@miguelsorianod miguelsorianod commented Aug 5, 2020

The original regular expression, that I understand was intended to validate a floating point number with optionally two decimal numbers exactly was not validating that specification.

This PR fixes the regular expression to validate it.

This applies to pricePerUnit, setupFee and costMonth fields

@miguelsorianod miguelsorianod requested a review from eguzki August 5, 2020 10:32
@miguelsorianod
Copy link
Contributor Author

miguelsorianod commented Aug 5, 2020

With the new regex the following values specified in costMonth (and also for the other fixed fields) have the following validation results:

"25.34" -> validation pass
"2" -> validation pass
"0.43" -> validation pass
"2.3" -> validation failure
"28.342" -> validation failure
"25a34" -> validation failure
"ab.cd" -> validation failure
"2.cd" -> validation failure
"ab.34" -> validation failure

@eguzki eguzki removed their assignment Aug 24, 2020
@miguelsorianod miguelsorianod force-pushed the fix-usd-regex-validation branch from 7d731f7 to d005d3b Compare August 25, 2020 12:23
This applies to pricePerUnit, setupFee and costMonth fields
@miguelsorianod miguelsorianod force-pushed the fix-usd-regex-validation branch from d005d3b to 93b0d0b Compare August 27, 2020 10:48
@codeclimate
Copy link

codeclimate bot commented Aug 27, 2020

Code Climate has analyzed commit 93b0d0b and detected 0 issues on this pull request.

View more on Code Climate.

@miguelsorianod miguelsorianod merged commit d04d47f into master Aug 27, 2020
@miguelsorianod miguelsorianod deleted the fix-usd-regex-validation branch August 27, 2020 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants