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

Add presence validation for enic_reason #9604

Merged
merged 1 commit into from
Aug 1, 2024
Merged

Conversation

gms-gs
Copy link
Contributor

@gms-gs gms-gs commented Jul 29, 2024

Context

Enforce presence validation for enic_reason on ApplicationQualifications ONLY on create

Changes proposed in this pull request

Add validates :enic_reason, presence: true, on: :create to the ApplicationQualification model

Things to check

  • If the code removes any existing feature flags, a data migration has also been added to delete the entry from the database
  • This code does not rely on migrations in the same Pull Request
  • If this code includes a migration adding or changing columns, it also backfills existing records for consistency
  • If this code adds a column to the DB, decide whether it needs to be in analytics yml file or analytics blocklist
  • API release notes have been updated if necessary
  • If it adds a significant user-facing change, is it documented in the CHANGELOG?
  • Required environment variables have been updated added to the Azure KeyVault
  • Inform data insights team due to database changes

Copy link
Contributor

@dcyoung-dev dcyoung-dev left a comment

Choose a reason for hiding this comment

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

How do you feel about adding specs for the endpoints that caused the Sentry errors?

@gms-gs
Copy link
Contributor Author

gms-gs commented Jul 30, 2024

How do you feel about adding specs for the endpoints that caused the Sentry errors?

I very feel! Yeahh Ill add that in

Copy link
Contributor

@dcyoung-dev dcyoung-dev left a comment

Choose a reason for hiding this comment

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

I think the tests aren't adding much value as they create Qualifications with an enic_reason we want to solve the issue of existing Qualifications that don't have an enic_reason first before we backfill. If we backfill first we run the risk of still having nils

@@ -121,6 +121,15 @@

expect(gcse.reload.grade).to eq('D')
end

it 'does not raise validation error for enic_reason being nil' do
Copy link
Contributor Author

@gms-gs gms-gs Jul 31, 2024

Choose a reason for hiding this comment

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

This test is just so we can be sure that when a user updates an existing qualification before the backfill PR, that we don't get enic_reason validation error. But we still want to validate the presence of an enic_reason on creation of any new qualifications. Reason for testing here is when we added the validation before it caused a validation error when updating a qualification. But as we now only validate on create this is expected test behaviour where it keeps the enic_reason as nil for an existing qualification

@gms-gs gms-gs merged commit 4a3a8f1 into main Aug 1, 2024
24 checks passed
@gms-gs gms-gs deleted the add-enic-reason-validation branch August 1, 2024 13:37
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