diff --git a/app/helpers/ballots_helper.rb b/app/helpers/ballots_helper.rb deleted file mode 100644 index c6fde9c57..000000000 --- a/app/helpers/ballots_helper.rb +++ /dev/null @@ -1,5 +0,0 @@ -module BallotsHelper - def progress_bar_width(amount_available, amount_spent) - (amount_spent / amount_available.to_f * 100).to_s + "%" - end -end diff --git a/app/models/budget/ballot.rb b/app/models/budget/ballot.rb index 399982d8e..34939adcd 100644 --- a/app/models/budget/ballot.rb +++ b/app/models/budget/ballot.rb @@ -66,7 +66,7 @@ class Budget delegate :amount_available, :amount_available_info, :amount_spent, :amount_spent_info, :amount_limit_info, :change_vote_info, :enough_resources?, :formatted_amount_available, :formatted_amount_limit, :formatted_amount_spent, :not_enough_resources_error, - :reason_for_not_being_ballotable, :voted_info, + :percentage_spent, :reason_for_not_being_ballotable, :voted_info, to: :voting_style private diff --git a/app/models/budget/voting_styles/base.rb b/app/models/budget/voting_styles/base.rb index e407641db..87bca2d59 100644 --- a/app/models/budget/voting_styles/base.rb +++ b/app/models/budget/voting_styles/base.rb @@ -34,6 +34,10 @@ class Budget::VotingStyles::Base amount: formatted_amount_limit(heading)) end + def percentage_spent(heading) + 100.0 * amount_spent(heading) / amount_limit(heading) + end + private def investments(heading) diff --git a/app/views/budgets/ballot/_progress_bar.html.erb b/app/views/budgets/ballot/_progress_bar.html.erb index 06206b7da..a068016ba 100644 --- a/app/views/budgets/ballot/_progress_bar.html.erb +++ b/app/views/budgets/ballot/_progress_bar.html.erb @@ -4,20 +4,16 @@
<%= t("budgets.progress_bar.assigned") %><%= @ballot.formatted_amount_spent(@heading) %>