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

Issue 1217 - csv upload validation #1403

Draft
wants to merge 13 commits into
base: development
Choose a base branch
from

Conversation

SageMar
Copy link
Contributor

@SageMar SageMar commented Dec 5, 2024

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:

  • Enabled
  • Disabled
  • Type
  • Timezone
  • Area
  • Cumulative
  • Reset
  • Timesort
  • End Only
  • Area Unit
  • Min Val
  • Max Val
  • Disabled Checks

Type of change

(Check the ones that apply by placing an "x" instead of the space in the [ ] so it becomes [x])

  • Note merging this changes the database configuration.
  • This change requires a documentation update

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.)

  • I have followed the OED pull request ideas
  • I have removed text in ( ) from the issue request
  • You acknowledge that every person contributing to this work has signed the OED Contributing License Agreement and each author is listed in the Description section.

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.

}

// Validates read values to either false or true
if (value !== 'true' && value !== 'false' && value !== true && value !== false) {
Copy link
Member

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.

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.

3 participants