Sha256: f3f9e1a90c44eeb1c3d431edf7c32ea22f975cc69daf6c4cf37825262a85c0bb
Contents?: true
Size: 1016 Bytes
Versions: 5
Compression:
Stored size: 1016 Bytes
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 components = Decidim::Component.where(participatory_space: spaces).published @query = Decidim::Proposals::Proposal.where(component: components).joins(:component) .left_outer_joins(:category) @query = @query.where("decidim_proposals_proposals.published_at <= ?", end_time).accepted @query = @query.group("decidim_categorizations.id", :participatory_space_type, :participatory_space_id) @query end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems