Sha256: 13be2a88cc9d6e63e2a4b7baa28cee27887282cfd30bf094d4a8983fd3129ead
Contents?: true
Size: 1.07 KB
Versions: 15
Compression:
Stored size: 1.07 KB
Contents
# frozen_string_literal: true module Decidim module Proposals module Metrics class AcceptedProposalsMetricManage < Decidim::Proposals::Metrics::ProposalsMetricManage def metric_name "accepted_proposals" end private def query return @query if @query spaces = Decidim.participatory_space_manifests.flat_map do |manifest| manifest.participatory_spaces.call(@organization).public_spaces end @query = Decidim::Proposals::Proposal.where(component: visible_component_ids_from_spaces(spaces)).joins(:component) .left_outer_joins(:category) @query = @query.where("decidim_proposals_proposals.created_at <= ?", end_time).accepted @query = @query.group("decidim_categorizations.id", :participatory_space_type, :participatory_space_id) @query end def quantity @quantity ||= query.where("decidim_proposals_proposals.created_at >= ?", start_time).count end end end end end
Version data entries
15 entries across 15 versions & 1 rubygems