Skip to content

Instantly share code, notes, and snippets.

@soniagrajales
Last active December 19, 2015 02:18
Show Gist options
  • Save soniagrajales/7af87c763f5aff6f617c to your computer and use it in GitHub Desktop.
Save soniagrajales/7af87c763f5aff6f617c to your computer and use it in GitHub Desktop.
# The following is the example of how I corrected the piggyback registrations associated to the user Nathan Archuleta
# with rm_user_id 187181 for the event with id 24521
reg_complete=EventRegistration.first(:conditions => { :event_id => 24521,:rm_user_id => 187181,:processed => true }) # find the parent and complete registration
EventRegistration.where(:event_id => 24521,:rm_user_id => 187181,:invoice_code => nil, :cost => nil, :service_fee => nil, :payment_notes => nil).each do |incomplete| # find the incomplete registrations and iterate over them
puts "CORRECTING EVENT REGISTRATION #{ incomplete.id }"
incomplete.processed = reg_complete.processed # update the processed field of the incomplete registration and set the processed value of the complete registration
incomplete.status = reg_complete.status # update the status field of the incomplete registration and set the status value of the complete registration
incomplete.cost = reg_complete.cost # update the cost field of the incomplete registration and set the cost value of the complete registration
incomplete.service_fee = reg_complete.service_fee # update the service_fee field of the incomplete registration and set the service_fee value of the complete registration
incomplete.club_team = reg_complete.club_team # update the club_team field of the incomplete registration and set the club_team value of the complete registration
incomplete.team_type = reg_complete.team_type # update the team_type field of the incomplete registration and set the team_type value of the complete registration
incomplete.team_id = reg_complete.team_id # update the team_id field of the incomplete registration and set the team_id value of the complete registration
incomplete.save # save changes made in the incomplete registration
end
@velospeed
Copy link

Step 2 - fixing problematic piggyback registrations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment