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

Don't clean data if we're invalid #168

Merged
merged 1 commit into from
Feb 5, 2023

Conversation

richardhallett
Copy link
Contributor

This is imo a bit of a hack.
Ideally data should never get saved that needs cleaning. But this is the simplest solution without major refactoring

Purpose

The reason the exception throws is that attempting to do model changes when the validation is invalid.

closes: #161

Approach

By checking validation before attempting to clean data

Open Questions and Pre-Merge TODOs

N/A

Learning

I spent way too much time digging about with this trying to do it properly, which imo would involve us saving the data, this is probably also more true now as we no longer have "old" style reports which had no attachments, when this was first created it was attempted to handle both cases.

So now we should ideally refactor this all out and probably remove the database column as well.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

  • New feature (non-breaking change which adds functionality)

  • Breaking change (fix or feature that would cause existing functionality to change)

Reviewer, please remember our guidelines:

  • Be humble in the language and feedback you give, ask don't tell.
  • Consider using positive language as opposed to neutral when offering feedback. This is to avoid the negative bias that can occur with neutral language appearing negative.
  • Offer suggestions on how to improve code e.g. simplification or expanding clarity.
  • Ensure you give reasons for the changes you are proposing.

This is imo a bit of a hack.
Ideally data should never get saved that needs cleaning.
But this is the simplest solution without major refactoring
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.

JSON schema validation failures return 500 error to user instead of validation error message
1 participant