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

Améliorer le message d'erreur de validation des nombres entiers #3427

Merged
merged 3 commits into from
Jan 19, 2024

Conversation

hfroot
Copy link
Collaborator

@hfroot hfroot commented Jan 11, 2024

I added the check for is base 10 a while back, but unfortunately the error message assumed that the number expected was decimal. This PR fixes that.

I haven't gone through all uses of isInteger and decimalPlaces, I suggest that is done in a second PR or as and when we spot them. Basically, these two should be the first in a list of validators so that the appropriate number format error message shows up. I wanted, however, to keep the base 10 check in all validators with numbers so that if the isInteger or decimalPlaces validators are forgotten, we still have the check.

Let me know though if you'd like to discuss approach more, maybe it would be better to not expect us/future devs to remember and throw a bigger error. Or an error just to the console ? As a reminder to use isInteger or decimalPlaces first.

…ecks in decimal places and integer validators; put number format validator first in canteen form
@hfroot hfroot marked this pull request as ready for review January 18, 2024 14:36
@hfroot hfroot requested a review from alemangui January 18, 2024 14:37
@hfroot
Copy link
Collaborator Author

hfroot commented Jan 18, 2024

@alemangui not sure why this was in draft, apologies if it turns out to be rubbish code

frontend/src/validators.js Outdated Show resolved Hide resolved
frontend/src/validators.js Outdated Show resolved Hide resolved
Co-authored-by: Alejandro M Guillén <alejandro@amguillen.dev>
@hfroot hfroot requested a review from alemangui January 19, 2024 10:46
@alemangui alemangui merged commit 86c0744 into staging Jan 19, 2024
5 checks passed
@alemangui alemangui deleted the number-format-error-msg branch January 19, 2024 12:47
@Tdauvet89
Copy link
Collaborator

Semble ok pour moi sur staging. GO pour prod

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

Successfully merging this pull request may close these issues.

3 participants