Files
nairobi/app/components/admin/stats/budget_supporting_component.rb
Javi Martín d25f2e7259 Add missing event name translations
We were always displaying the event names in English.

Note we're changing the `user_supported_budgets` key because it didn't
make much sense; the investments are supported, and not the budgets.

We're also adding "created" to most of the event names in order to make
the texts more explicit, since not all the events refer to created data.
2024-05-09 14:28:32 +02:00

36 lines
682 B
Ruby

class Admin::Stats::BudgetSupportingComponent < ApplicationComponent
attr_reader :budget
def initialize(budget)
@budget = budget
end
private
def stats
@stats ||= Budget::Stats.new(budget)
end
def headings_stats
@headings_stats ||= stats.headings
end
def vote_count
stats.total_supports
end
def user_count
stats.total_participants_support_phase
end
def user_count_by_heading
budget.headings.map do |heading|
[heading, headings_stats[heading.id][:total_participants_support_phase]]
end
end
def chart
@chart ||= Ahoy::Chart.new("budget_investment_supported")
end
end