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
Conversation
|
||
require_relative '../../../dashboard/config/environment' | ||
|
||
File.readlines(ARGV[0]).each do |line| |
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.
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! |
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.
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.
user.save! | ||
puts("user #{id} - success") | ||
rescue | ||
puts("user #{id} - ERROR - other") |
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.
Doubt there will be any errors persisting the record, but if there are it would be handy to out the error message here.
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.
My plan is that if there are errors here, to rerun this script over those users with more useful output
To be used as part of the follow-up to #31282