Skip to content

Commit

Permalink
fixed issue in newsletter send nullifying status
Browse files Browse the repository at this point in the history
  • Loading branch information
swapnilchincholkar committed Jul 2, 2020
1 parent 62f742f commit 1dcf2ce
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/workers/light/hard_worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 1dcf2ce

Please sign in to comment.