adds rake task to send current unfeasible spending proposals

This commit is contained in:
rgarcia
2016-03-28 18:26:09 +02:00
parent 26039d4906
commit 57299ec968
2 changed files with 14 additions and 1 deletions

View File

@@ -73,7 +73,7 @@ class SpendingProposal < ActiveRecord::Base
end
def unfeasible?
not feasible?
feasible == false
end
def valuation_finished?

View File

@@ -0,0 +1,13 @@
namespace :spending_proposals do
desc "Sends an email to the authors of unfeasible spending proposals"
task send_unfeasible_emails: :environment do
SpendingProposal.find_each do |spending_propsal|
if spending_propsal.marked_as_unfeasible?
spending_propsal.send_unfeasible_email
puts "email sent for proposal #{spending_propsal.title}"
else
puts "this proposal is feasible: #{spending_propsal.title}"
end
end
end
end