-
Notifications
You must be signed in to change notification settings - Fork 317
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
Issue 1217 - csv upload validation #1403
base: development
Are you sure you want to change the base?
Issue 1217 - csv upload validation #1403
Conversation
…ion for checking each value towards the bottom of the uploadMeters.js file as well as calling them when the submission is sent to the server
… made sure the correct data was being sent back to the client side
…ifferent caps/lowercase
Boolean value validations
Min max validation
} | ||
|
||
// Validates read values to either false or true | ||
if (value !== 'true' && value !== 'false' && value !== true && value !== false) { |
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 know this is a draft PR but a number of the tests were failing. I debugged one of them. The issue is that endOnlyTime on a meter can be undefined. In src/server/sql/meter/create_meters_table.sql it will set it to a default value if undefined. Thus, some tests need to allow for this.
I also noticed that a few inputs go through normalizeBoolean() that allows for yes/no in addition to true/false. FYI.
Please let me know if you need any more information or help.
Description
"The create meter page stops admins from entering bad values by constraining choices and/or checking before saving. It would be good if the CSV meter upload page did similar checks." After a talk with Steve, it was decided that this validation should be done in JavaScript on the back-end, so these validations are inside the uploadMeters.js file.
Partly Addresses #1217
This adds validations for the following variables:
Type of change
(Check the ones that apply by placing an "x" instead of the space in the [ ] so it becomes [x])
Checklist
(Note what you have done by placing an "x" instead of the space in the [ ] so it becomes [x]. It is hoped you do all of them.)
Limitations
There are still several columns that have not been added to the validations yet, our goal is to add several more of these before we submit this pull request for review.