Class: Decidim::Elections::Trustees::ByParticipatorySpace

Inherits:
Rectify::Query
  • Object
show all
Defined in:
decidim-elections/app/queries/decidim/elections/trustees/by_participatory_space.rb

Overview

A class used to find trustees by participatory space.

Instance Method Summary collapse

Constructor Details

#initialize(participatory_space) ⇒ ByParticipatorySpace

Initializes the class.


10
11
12
# File 'decidim-elections/app/queries/decidim/elections/trustees/by_participatory_space.rb', line 10

def initialize(participatory_space)
  @participatory_space = participatory_space
end

Instance Method Details

#queryObject

Gets trustees by participatory space.


15
16
17
18
19
20
# File 'decidim-elections/app/queries/decidim/elections/trustees/by_participatory_space.rb', line 15

def query
  Decidim::Elections::Trustee
    .includes([:user])
    .joins(:trustees_participatory_spaces)
    .merge(Decidim::Elections::TrusteesParticipatorySpace.where(participatory_space: @participatory_space, considered: true))
end