Class: Decidim::Meetings::Metrics::MeetingFollowersMetricMeasure
- Inherits:
-
Decidim::MetricMeasure
- Object
- Decidim::MetricMeasure
- Decidim::Meetings::Metrics::MeetingFollowersMetricMeasure
- Defined in:
- app/queries/decidim/meetings/metrics/meeting_followers_metric_measure.rb
Overview
Searches for unique Users following the next objects
- Meetings
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/meetings/metrics/meeting_followers_metric_measure.rb', line 13 def calculate meetings = Decidim::Meetings::Meeting.where(component: @resource).joins(:component) meetings_followers = Decidim::Follow.where(followable: meetings).joins(:user) .where("decidim_follows.created_at <= ?", end_time) cumulative_users = meetings_followers.pluck(:decidim_user_id) meetings_followers = meetings_followers.where("decidim_follows.created_at >= ?", start_time) quantity_users = meetings_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/meetings/metrics/meeting_followers_metric_measure.rb', line 9 def valid? super && @resource.is_a?(Decidim::Component) end |