Hacktoberfest / hacktoberfest-2020

Hacktoberfest - App to manage the annual open-source challenge, used for the 2019 & 2020 seasons.
https://hacktoberfest.digitalocean.com
Other
497 stars 145 forks source link

Add rescue to rake and add force rake #651

Closed MattIPv4 closed 3 years ago

MattIPv4 commented 3 years ago

Description

In the event we have a bad user, the rake would fail. This adds rescue logic around the save, so we are made aware of broken users but it doesn't fail. We then have a second rake to set the values for everyone.

docker-compose exec app bundle exec rake users:backfill_acceptance

#<User id: 2, name: "test", email: "test@test.com", uid: -1, provider_token: "SNIP", created_at: "2020-10-07 14:45:10", updated_at: "2020-10-07 16:00:13", provider: "github", terms_acceptance: true, digitalocean_marketing_emails: false, state: "registered", receipt: nil, intel_marketing_emails: false, dev_marketing_emails: false, category: "participant", country: nil, quality_acceptance: true, disqualify_acceptance: true>
#<GithubPullRequestService::UserNotFoundOnGithubError: GithubPullRequestService::UserNotFoundOnGithubError>

Exit 0

docker-compose exec app bundle exec rake users:force_backfill_acceptance

Exit 0

Test process

Running the rakes works.

Requirements to merge

MattIPv4 commented 3 years ago

Tested on staging, normal rake correctly handles bad users, force works cleanly too.