Last active
December 18, 2015 14:58
-
-
Save jonstorer/5800783 to your computer and use it in GitHub Desktop.
Fetch member's email gift card code and challenge code for jen
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
require 'ruby-progressbar' | |
module PrizeMetaData | |
def self.run! | |
wins = PrizeWin.where(:drawing_id.in => Drawing.last_month.crowd.map(&:id)) | |
progress = ProgressBar.create(:title => "#{Date::MONTHNAMES[1.month.ago.month]} Wins", :total => wins.count.to_i, :format => '%t |%b[%P%%]%i| %c/%C [%E]') | |
File.open("/home/deploy/tmp/prizing_#{Date::MONTHNAMES[1.month.ago.month].downcase}_email_codes_challenges.csv", 'a+') do |file| | |
file.puts "email, url, challenge" | |
wins.each do |win| | |
file.puts "#{win.member.email}, #{win.cashstar_fulfillment.url}, #{win.cashstar_fulfillment.challenge}" | |
progress.increment | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
lgtm