Last active
December 18, 2015 02:58
-
-
Save jonstorer/5714330 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
@members = {} | |
Brand.all.each do |brand| | |
if drawing = brand.drawings.crowd.last_month.first | |
wins = PrizeWin.where(:drawing_id => drawing.id) | |
progress = ProgressBar.create(:title => brand.slug, :total => wins.count.to_i, :format => '%t |%b[%P%%]%i| %c/%C [%E]') | |
wins.each do |win| | |
email = win.member.email | |
@members[email] ||= 0 | |
@members[email] = @members[email].to_i + 1 | |
progress.increment | |
end | |
end | |
end | |
File.open('/home/deploy/tmp/prizing.csv', 'w') do |file| | |
@members.each_pair do |email, count| | |
file.puts "#{email}, #{count}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment