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

Migration for partner agency cleanup re issue 4241. Necessary step, … #4801

Merged
merged 3 commits into from
Dec 18, 2024

Conversation

cielf
Copy link
Collaborator

@cielf cielf commented Nov 25, 2024

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

  • Breaking change (fix or feature that would cause existing functionality to not work as expected) (I guess?)

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

profiles = Partners::Profile.where(agency_type: type_pair[0])
profiles.each do |profile|
profile.agency_type = Partner::AGENCY_TYPES[type_pair[1]]
profile.save
Copy link
Collaborator

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.

Copy link
Collaborator Author

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

Copy link
Collaborator Author

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

Copy link
Collaborator Author

@cielf cielf Nov 27, 2024

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)
Copy link
Collaborator

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?

Copy link
Collaborator Author

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.

@cielf
Copy link
Collaborator Author

cielf commented Nov 27, 2024

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.

@cielf cielf added the BLOCKED This issue is blocked by another label Nov 27, 2024
@cielf
Copy link
Collaborator Author

cielf commented Dec 4, 2024

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.

@cielf cielf removed the BLOCKED This issue is blocked by another label Dec 15, 2024
@cielf
Copy link
Collaborator Author

cielf commented Dec 17, 2024

@dorner #4829 cleaned up the issues where these couldn't be saved for other reasons -- so this is available for your ok.

Copy link
Collaborator

@dorner dorner left a comment

Choose a reason for hiding this comment

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

Nice!

@dorner dorner merged commit e1dc5af into rubyforgood:main Dec 18, 2024
11 checks passed
Copy link
Contributor

@cielf: Your PR Migration for partner agency cleanup re issue 4241. Necessary step, … is part of today's Human Essentials production release: 2024.12.22.
Thank you very much for your contribution!

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