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.
36 lines
682 B
Ruby
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
|