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 script to reset race data for a subset of users #31491

Merged
merged 2 commits into from Oct 25, 2019
Merged

Conversation

Hamms
Copy link
Contributor

@Hamms Hamms commented Oct 25, 2019

To be used as part of the follow-up to #31282

@Hamms Hamms requested a review from sureshc October 25, 2019 19:10

require_relative '../../../dashboard/config/environment'

File.readlines(ARGV[0]).each do |line|
Copy link
Contributor

Choose a reason for hiding this comment

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

It's probably worth rescuing any error that is raised within this block. Log the id that failed and then move on to the next one.

end

user.races = nil
user.save!
Copy link
Contributor

Choose a reason for hiding this comment

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

In addition to rescuing/logging errors, maybe log the id of every User that is successfully saved? That helps track what went right/wrong after the script has been run.

@Hamms Hamms requested a review from sureshc October 25, 2019 20:32
user.save!
puts("user #{id} - success")
rescue
puts("user #{id} - ERROR - other")
Copy link
Contributor

Choose a reason for hiding this comment

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

Doubt there will be any errors persisting the record, but if there are it would be handy to out the error message here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My plan is that if there are errors here, to rerun this script over those users with more useful output

@Hamms Hamms merged commit 60cc8e4 into staging Oct 25, 2019
@Hamms Hamms deleted the reset-race-data branch October 25, 2019 21:44
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.

None yet

2 participants