Avoid task exit when deliver with bad emails addresses.
This commit is contained in:
parent
d11c619c82
commit
84699a9052
1 changed files with 17 additions and 5 deletions
|
@ -32,8 +32,12 @@ namespace :foodsoft do
|
||||||
puts "Send notifications for #{task.name} to .."
|
puts "Send notifications for #{task.name} to .."
|
||||||
for user in task.users
|
for user in task.users
|
||||||
if user.settings['notify.upcoming_tasks'] == 1
|
if user.settings['notify.upcoming_tasks'] == 1
|
||||||
|
begin
|
||||||
puts "#{user.email}.."
|
puts "#{user.email}.."
|
||||||
Mailer.deliver_upcoming_tasks(user, task)
|
Mailer.deliver_upcoming_tasks(user, task)
|
||||||
|
rescue
|
||||||
|
puts "deliver aborted for #{user.email}.."
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -60,7 +64,11 @@ namespace :foodsoft do
|
||||||
puts "Notify workgroup: #{workgroup.name} for task #{task.name}"
|
puts "Notify workgroup: #{workgroup.name} for task #{task.name}"
|
||||||
for user in workgroup.users
|
for user in workgroup.users
|
||||||
if user.settings['messages.sendAsEmail'] == "1" && !user.email.blank?
|
if user.settings['messages.sendAsEmail'] == "1" && !user.email.blank?
|
||||||
|
begin
|
||||||
Mailer.deliver_not_enough_users_assigned(task, user)
|
Mailer.deliver_not_enough_users_assigned(task, user)
|
||||||
|
rescue
|
||||||
|
puts "deliver aborted for #{user.email}"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -86,7 +94,11 @@ namespace :foodsoft do
|
||||||
# Notifications
|
# Notifications
|
||||||
for group_order in order.group_orders
|
for group_order in order.group_orders
|
||||||
for user in group_order.ordergroup.users
|
for user in group_order.ordergroup.users
|
||||||
|
begin
|
||||||
Mailer.deliver_order_result(user, group_order) if user.settings["notify.orderFinished"] == '1'
|
Mailer.deliver_order_result(user, group_order) if user.settings["notify.orderFinished"] == '1'
|
||||||
|
rescue
|
||||||
|
puts "deliver aborted for #{user.email}.."
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue