Files
nairobi/app/models/budget/voting_styles/approval.rb
Ziyan Junaideen 1e3e8c1304 Add approval voting to budgets
Co-Authored-By: Javi Martín <javim@elretirao.net>
2020-08-06 12:38:18 +02:00

26 lines
517 B
Ruby

class Budget::VotingStyles::Approval < Budget::VotingStyles::Base
def enough_resources?(investment)
amount_available(investment.heading) > 0
end
def reason_for_not_being_ballotable(investment)
:not_enough_available_votes unless enough_resources?(investment)
end
def not_enough_resources_error
"insufficient votes"
end
def amount_spent(heading)
investments(heading).count
end
def amount_limit(heading)
heading.max_ballot_lines
end
def format(amount)
amount
end
end