Sha256: 3368539e64fdfff36d71b2b5896ec18927e834ca2fe6e691fb61c063bd2d4c01
Contents?: true
Size: 1.45 KB
Versions: 1
Compression:
Stored size: 1.45 KB
Contents
# frozen_string_literal: true module Decidim # This service is in charge of gathering the ParticipatoryProcess and # ParticipatoryProcessGroup that are public and should be displayed together. class PublicProcesses # Initializes the PublicProcesses # # organization - The current organization def initialize(organization) @organization = organization end # Public: The collection of published processes and groups from the given # organization to be displayed at processes index. # # Returns an Array. def collection (participatory_processes + participatory_process_groups).flatten end # Public: The collection of published ParticipatoryProcess to be displayed at the # process index. # # Returns an ActiveRecord::Relation. def participatory_processes @participatory_processes ||= ordered_processes.published end private attr_reader :organization def ordered_processes @sorted_processes ||= Decidim::ParticipatoryProcess.where(organization: organization) .order("promoted DESC") .includes(:active_step) .order("decidim_participatory_process_steps.end_date ASC") end def participatory_process_groups Decidim::ParticipatoryProcessGroup.where(organization: organization) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
decidim-core-0.1.0 | app/services/decidim/public_processes.rb |