Sha256: 2afddc118702add94cd8a8f19f912805ed9d96ae0e7ec1e34127b91760069471
Contents?: true
Size: 925 Bytes
Versions: 58
Compression:
Stored size: 925 Bytes
Contents
# frozen_string_literal: true module Decidim module Budgets module Metrics # Searches for Participants in the following actions # - Vote a participatory budgeting project (Budgets) class BudgetParticipantsMetricMeasure < Decidim::MetricMeasure def valid? super && @resource.is_a?(Decidim::Component) end 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 end end end end
Version data entries
58 entries across 58 versions & 1 rubygems