add test mode to emailer
This commit is contained in:
parent
460081bc2f
commit
9bc8934970
1 changed files with 3 additions and 3 deletions
|
|
@ -2,7 +2,7 @@
|
||||||
# licensed under the Affero General Public License version 3 or later. See
|
# licensed under the Affero General Public License version 3 or later. See
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
module RakeHelpers
|
module RakeHelpers
|
||||||
def process_emails(csv, num_to_process, offset, num_invites=10)
|
def process_emails(csv, num_to_process, offset, num_invites=10, test=true)
|
||||||
if RUBY_VERSION.include? "1.8"
|
if RUBY_VERSION.include? "1.8"
|
||||||
require 'fastercsv'
|
require 'fastercsv'
|
||||||
backers = FasterCSV.read(csv)
|
backers = FasterCSV.read(csv)
|
||||||
|
|
@ -10,7 +10,7 @@ module RakeHelpers
|
||||||
require 'csv'
|
require 'csv'
|
||||||
backers = CSV.read(csv)
|
backers = CSV.read(csv)
|
||||||
end
|
end
|
||||||
|
puts "IN TEST MODE" if test
|
||||||
churn_through = 0
|
churn_through = 0
|
||||||
num_to_process.times do |n|
|
num_to_process.times do |n|
|
||||||
if backers[n+offset] == nil
|
if backers[n+offset] == nil
|
||||||
|
|
@ -21,7 +21,7 @@ module RakeHelpers
|
||||||
backer_email = backers[n+offset][1].to_s.gsub('.ksr', '').strip
|
backer_email = backers[n+offset][1].to_s.gsub('.ksr', '').strip
|
||||||
unless User.find_by_email(backer_email)
|
unless User.find_by_email(backer_email)
|
||||||
puts "sending email to: #{backer_name} #{backer_email}" unless Rails.env == 'test'
|
puts "sending email to: #{backer_name} #{backer_email}" unless Rails.env == 'test'
|
||||||
Invitation.create_invitee(:email => backer_email, :name => backer_name, :invites => num_invites)
|
Invitation.create_invitee(:email => backer_email, :name => backer_name, :invites => num_invites) unless test
|
||||||
else
|
else
|
||||||
puts "user with the email exists: #{backer_email} , #{backer_name} " unless Rails.env == 'test'
|
puts "user with the email exists: #{backer_email} , #{backer_name} " unless Rails.env == 'test'
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue