Created
June 18, 2015 21:36
-
-
Save BananaNeil/dee8b84519372894f50a to your computer and use it in GitHub Desktop.
Destroy duplicate mobile notifications
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
bill_ids = Persistence::MobileNotification.group(:bill_id).count.select{|k,v| v > 1}.map(&:first) | |
Persistence::Bill.where(id: bill_ids, congress: 114).each do |b| | |
notifications = b.mobile_notifications | |
puts b.bill_id.green | |
notifications.each_with_index {|n, i| puts "#{i}) #{n.message.strip}".yellow} | |
print 'Keep which one? '.light_blue | |
(notifications - [notifications[gets.strip.to_i]]).each {|n| puts "DESTROYING #{n.message}".red;n.destroy} | |
end;nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment