Sha256: 845221c9c7cd40911e16971ec0297b2ddd09164dea3b0c0da9c2fbc941a0a0a2
Contents?: true
Size: 1.28 KB
Versions: 3
Compression:
Stored size: 1.28 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
decidim-core-0.0.8.1 | app/services/decidim/public_processes.rb |
decidim-core-0.0.7 | app/services/decidim/public_processes.rb |
decidim-core-0.0.6 | app/services/decidim/public_processes.rb |