Created
December 17, 2012 19:39
-
-
Save ewpeters/4321312 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env script/minrunner | |
MemberVisitor.find(:all, :conditions => "snap_user_id is not null and destination_id is null").each do |member| | |
snap_acct = Snap::Member.find(member.snap_user_id) rescue nil | |
if snap_acct && snap_acct.phone_number.present? | |
dest = Destination.find_by_ANI(snap_acct.phone_number) | |
if dest | |
$stdout.puts "#{member.id},#{dest.id}" | |
member.destinations << dest unless member.destinations.include?(dest) | |
member.create_snap_destination | |
member.save | |
else | |
$stderr.puts "Couldnt find destination #{snap_acct.phone_number}" | |
end | |
else | |
$stderr.puts "No acct or Phone number for #{member.snap_user_id}" | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment