From 1dcf2ce9d940b92077c6f94053bac8ca5ba5bee4 Mon Sep 17 00:00:00 2001 From: Swapnil Chincholkar Date: Thu, 2 Jul 2020 18:05:08 +0530 Subject: [PATCH] fixed issue in newsletter send nullifying status --- app/workers/light/hard_worker.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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