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

Update numeric question validity checks #2027

Conversation

deundrewilliams
Copy link
Member

Resolves #2012

The initial issue was that the editor allows saving when a margin of error question is created with an answer of 0 and an error type of 'Percent', which would cause a blank screen error when viewing the assessment. This also occurs if any other input for numeric questions is invalid (range invalid, answer can't be parsed to a number, etc.). The first part of these changes adds a validity check to make sure that a margin of error question doesn't have an answer of 0 with an error type of 'Percent'. The other part adds a check before saving that checks the validity of all input and select fields. If any are invalid, the module won't be saved and an alert will be shown, so this will prevent any type of invalid input from being saved.

Copy link
Contributor

@FrenjaminBanklin FrenjaminBanklin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a succinct change that works great. Well done!

I think I'd like to see this embellished a bit - rather than a standard browser alert, maybe using a fancier-looking component that provides specific details about any existing issues and potentially can move focus to the issues for quicker recovery.

For now, this is a great start.

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