Split common and specific stats methods
This commit is contained in:
@@ -3,11 +3,11 @@ class Budget::Stats
|
||||
alias_method :budget, :resource
|
||||
|
||||
def self.stats_methods
|
||||
%i[total_participants total_participants_support_phase total_participants_vote_phase
|
||||
super +
|
||||
%i[total_participants_support_phase total_participants_vote_phase
|
||||
total_budget_investments total_votes total_selected_investments
|
||||
total_unfeasible_investments total_male_participants total_female_participants
|
||||
total_supports total_unknown_gender_or_age age_groups male_percentage
|
||||
female_percentage headings total_participants_web total_participants_booths]
|
||||
total_unfeasible_investments total_supports headings
|
||||
total_participants_web total_participants_booths]
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -70,6 +70,12 @@ module Statisticable
|
||||
end
|
||||
|
||||
class_methods do
|
||||
def stats_methods
|
||||
%i[total_participants total_male_participants
|
||||
total_female_participants total_unknown_gender_or_age
|
||||
male_percentage female_percentage age_groups]
|
||||
end
|
||||
|
||||
def stats_cache(*method_names)
|
||||
method_names.each do |method_name|
|
||||
alias_method :"raw_#{method_name}", method_name
|
||||
|
||||
Reference in New Issue
Block a user