Sha256: af38e488ca587903317b64bd16787d32a2ddb23376963fb2aeea481776bcf9b4
Contents?: true
Size: 941 Bytes
Versions: 3
Compression:
Stored size: 941 Bytes
Contents
# frozen_string_literal: true module Decidim module ParticipatoryProcesses # This query class filters participatory processes groups given a filter name. # The filter is applied checking the start and end dates of the processes in # the group. class FilteredParticipatoryProcessGroups < Rectify::Query def initialize(filter = "active") @filter = filter end def query processes = Decidim::ParticipatoryProcess.all processes = case @filter when "past" processes.past when "upcoming" processes.upcoming when "active" processes.active else processes end Decidim::ParticipatoryProcessGroup.where(id: processes.pluck(:decidim_participatory_process_group_id)) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems