-
-
Notifications
You must be signed in to change notification settings - Fork 503
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
Migration for partner agency cleanup re issue 4241. Necessary step, … #4801
Migration for partner agency cleanup re issue 4241. Necessary step, … #4801
Conversation
…ut does not complete that issue.
profiles = Partners::Profile.where(agency_type: type_pair[0]) | ||
profiles.each do |profile| | ||
profile.agency_type = Partner::AGENCY_TYPES[type_pair[1]] | ||
profile.save |
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.
Always better to do save!
in case something goes wrong.
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.
Excellent catch! It turns out that this is going to be blocked by whatever pickup emails are still wrong. (Le Sigh.)
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 suppose we could use update_attribute! ? Let me see how widespread the pickup email actually is
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.
There are also some that don't pass because of the rule about social media (which, I presume, haven't been changed since we added that rule.) All told, about 40 partners that are currently invalid. About a dozen of them are non-trivial. Let's talk Sunday.
|
||
|
||
profiles = Partners::Profile | ||
.where.not(agency_type: Partner::AGENCY_TYPES.values) |
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.
Shouldn't this be keys
, not values
?
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 get why you would think that - but what is currently stored in the db is the values not the keys. Probably as a legacy from when it was a free-form field.
This is blocked until we can get the pickup emails cleaned up. We had been allowing that to gently get fixed over a period of time, but we're going to have to reach out to the banks concerned. |
The above pr cleans up the invalid profiles, and should allow this to go forward. Once it's in prod, I'll check this against a new copy of produciton. |
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.
Nice!
@cielf: Your PR |
Migration for partner agency cleanup re issue #4241. Necessary step, ……but does not complete that issue.
Description
Once upon a time, agency_type was freeform, so there were a fair number of non-standard values in it.
We talked to NDBN, and got a mapping of those values to the standard agency types, where possible.
This involved adding 3 new types as well.
Please refer to the issue for the mapping.
The agency types that were not mappable are designated as other, and the original agency_type goes to the other_agency_type field.
This PR is a one-way migration to effect those changes.
It replaces PR #4261, which I will close.
Unblocks #4254
Type of change
How Has This Been Tested?
Spot checked that a case with conversion and a case that goes to other worked against copy of prod data