Files
nairobi/lib/tasks/dashboards.rake
taitus 5177adb32a New rake task for proposals to send new action email
Execute rake task every day to detect new actions available for not archived proposals. If there are new actions available for today, send email to proposal's author with information text, new actions available and link to proposal dashboard url.
2019-03-21 12:29:28 +01:00

19 lines
600 B
Ruby

namespace :dashboards do
desc "Send to user notifications from new actions availability on dashboard"
task send_notifications: :environment do
Proposal.not_archived.each do |proposal|
new_actions_ids = Dashboard::Action.detect_new_actions(proposal)
if new_actions_ids.present?
if proposal.published?
Dashboard::Mailer.new_actions_notification_rake_published(proposal, new_actions_ids).deliver_later
else
Dashboard::Mailer.new_actions_notification_rake_created(proposal, new_actions_ids).deliver_later
end
end
end
end
end