diff --git a/app/workers/light/hard_worker.rb b/app/workers/light/hard_worker.rb index 1a423e3..3b86625 100644 --- a/app/workers/light/hard_worker.rb +++ b/app/workers/light/hard_worker.rb @@ -5,7 +5,7 @@ class HardWorker def perform(user_ids, newsletter_id, date, status = nil) newsletter = Light::Newsletter.where(id: newsletter_id).first - user_ids.each do |id| + user_ids.each do |id| user = Light::User.where(id: id, :sent_on.nin => [date]).first if user.present? Light::UserMailer.welcome_message(user.email_id, newsletter, user.token).deliver @@ -15,12 +15,12 @@ def perform(user_ids, newsletter_id, date, status = nil) sidekiq_status: status, opt_in_mail_sent_at: DateTime.now) elsif status.present? && status.include?('Opt out') - user.update_attributes(sent_on: sent_on, + user.update_attributes(sent_on: sent_on, sidekiq_status: 'Subscribed', subscribed_at: DateTime.now, is_subscribed: true) else - user.update_attributes(sent_on: sent_on, sidekiq_status: status) + user.update_attributes(sent_on: sent_on) end end end