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