Class: Decidim::Budgets::Metrics::BudgetParticipantsMetricMeasure
- Inherits:
-
MetricMeasure
- Object
- MetricMeasure
- Decidim::Budgets::Metrics::BudgetParticipantsMetricMeasure
- Defined in:
- app/queries/decidim/budgets/metrics/budget_participants_metric_measure.rb
Overview
Searches for Participants in the following actions
- Vote a participatory budgeting project (Budgets)
Instance Method Summary collapse
Instance Method Details
#calculate ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/queries/decidim/budgets/metrics/budget_participants_metric_measure.rb', line 13 def calculate budgets = Decidim::Budgets::Budget.where(component: @resource) orders = Decidim::Budgets::Order.where(budget: budgets) .finished .where("decidim_budgets_orders.checked_out_at <= ?", end_time) { cumulative_users: orders.pluck(:decidim_user_id), quantity_users: orders.where("decidim_budgets_orders.checked_out_at >= ?", start_time).pluck(:decidim_user_id) } end |
#valid? ⇒ Boolean
9 10 11 |
# File 'app/queries/decidim/budgets/metrics/budget_participants_metric_measure.rb', line 9 def valid? super && @resource.is_a?(Decidim::Component) end |