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

Clean up addresses #2249

Merged
merged 6 commits into from
Feb 19, 2024
Merged

Clean up addresses #2249

merged 6 commits into from
Feb 19, 2024

Conversation

ivan-kocienski-gfsc
Copy link
Contributor

@ivan-kocienski-gfsc ivan-kocienski-gfsc commented Feb 15, 2024

Closes #2005

A rake task db:clean_bad_addresses that deletes addresses that have no place, partner or event.
Minor tidy up of Address and Event models.

But...

It looks like the calendar importer orphans addresses as it runs. Further investigation is needed as to where/why this is happening. (#2254)

@ivan-kocienski-gfsc
Copy link
Contributor Author

Random thoughts from the placecal-ops channel:

this is a bit of a rabbit hole. just found that addresses have a link to calendars BUT the calendar table has no FK, so if you event.calendars it just raises a "missing field" exception.
[16:00]
we also appear to (or did at one point) recycle addresses, so one address has hundreds of events, which i am not sure is correct given how we decided that each partner will have its own address. not sure what the rationale (utility) for having events share addresses is.
[16:03]
like- an event can have its own address, or it can get the address from the partner and that is it. maybe we allow people to find events in their (the sites) neighbourhood that have no associated partner?

@ivan-kocienski-gfsc ivan-kocienski-gfsc marked this pull request as ready for review February 19, 2024 09:39
@aaaaargZombies aaaaargZombies self-assigned this Feb 19, 2024
@aaaaargZombies
Copy link
Contributor

$time rake db:clean_bad_addresses 
found 1161163 addresses
  1160881 orphaned addresses found
rake db:clean_bad_addresses  4.67s user 0.37s system 0% cpu 48:49.77 total
irb(main):001> Address.all.length
  Address Load (18.7ms)  SELECT "addresses".* FROM "addresses"
=> 282

big improvement in speed (and num of addressed)

Copy link
Contributor

@aaaaargZombies aaaaargZombies left a comment

Choose a reason for hiding this comment

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

🌱 time for a spring clean

@ivan-kocienski-gfsc ivan-kocienski-gfsc merged commit bceb22c into main Feb 19, 2024
2 checks passed
@ivan-kocienski-gfsc ivan-kocienski-gfsc deleted the ik-2005-clean-up-addresses branch February 19, 2024 14:54
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.

Clean out broken Addresses
2 participants