Class: Decidim::ParticipatoryProcesses::Metrics::ParticipatoryProcessFollowersMetricMeasure
- Inherits:
-
MetricMeasure
- Object
- MetricMeasure
- Decidim::ParticipatoryProcesses::Metrics::ParticipatoryProcessFollowersMetricMeasure
- Defined in:
- app/queries/decidim/participatory_processes/metrics/participatory_process_followers_metric_measure.rb
Overview
Searches for unique Users following the next objects
- ParticipatoryProcesses
Instance Method Summary collapse
Instance Method Details
#calculate ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/queries/decidim/participatory_processes/metrics/participatory_process_followers_metric_measure.rb', line 13 def calculate participatory_process = @resource process_followers = Decidim::Follow.where(followable: participatory_process).joins(:user) .where("decidim_follows.created_at <= ?", end_time) cumulative_users = process_followers.pluck(:decidim_user_id) process_followers = process_followers.where("decidim_follows.created_at >= ?", start_time) quantity_users = process_followers.pluck(:decidim_user_id) { cumulative_users: cumulative_users.uniq, quantity_users: quantity_users.uniq } end |
#valid? ⇒ Boolean
9 10 11 |
# File 'app/queries/decidim/participatory_processes/metrics/participatory_process_followers_metric_measure.rb', line 9 def valid? super && @resource.is_a?(Decidim::Participable) end |