# frozen_string_literal: true

module GobiertoParticipation
  class WelcomeController < GobiertoParticipation::ApplicationController
    def index
      @processes = current_site.processes.process.open
      @issues = current_site.issues.alphabetically_sorted
      @participation_events = find_participation_events.page(params[:page])
      @participation_news = find_participation_news.page(params[:page])
    end

    private

    def find_participation_events
      ::GobiertoCalendars::Event.events_in_collections_and_container_type(current_site, "GobiertoParticipation").sorted.published
    end

    def find_participation_news
      ::GobiertoCms::Page.pages_in_collections_and_container_type(current_site, "GobiertoParticipation").sorted.active
    end
  end
end

# frozen_string_literal: true

module GobiertoParticipation
  class WelcomeController < GobiertoParticipation::ApplicationController
    def index
      @processes = current_site.processes.process.open.active
      @issues = current_site.issues.alphabetically_sorted
      @participation_events = find_participation_events.page(params[:page])
      @participation_news = find_participation_news.page(params[:page])
    end

    private

    def find_participation_events
      ::GobiertoCalendars::Event.events_in_collections_and_container_type(current_site, "GobiertoParticipation").sorted.published
    end

    def find_participation_news
      ::GobiertoCms::Page.pages_in_collections_and_container_type(current_site, "GobiertoParticipation").sorted.active
    end
  end
end

Fix open and active processes in participation home
Fix open and active processes in participation home
