Class: Decidim::Proposals::Metrics::ProposalFollowersMetricMeasure
- Inherits:
-
MetricMeasure
- Object
- MetricMeasure
- Decidim::Proposals::Metrics::ProposalFollowersMetricMeasure
- Defined in:
- app/queries/decidim/proposals/metrics/proposal_followers_metric_measure.rb
Overview
Searches for unique Users following the next objects
- Proposals
- CollaborativeDrafts
Instance Method Summary collapse
Instance Method Details
#calculate ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/queries/decidim/proposals/metrics/proposal_followers_metric_measure.rb', line 14 def calculate cumulative_users = [] cumulative_users |= retrieve_proposals_followers.pluck(:decidim_user_id) cumulative_users |= retrieve_drafts_followers.pluck(:decidim_user_id) quantity_users = [] quantity_users |= retrieve_proposals_followers(from_start: true).pluck(:decidim_user_id) quantity_users |= retrieve_drafts_followers(from_start: true).pluck(:decidim_user_id) { cumulative_users: cumulative_users.uniq, quantity_users: quantity_users.uniq } end |
#valid? ⇒ Boolean
10 11 12 |
# File 'app/queries/decidim/proposals/metrics/proposal_followers_metric_measure.rb', line 10 def valid? super && @resource.is_a?(Decidim::Component) end |