Class: Decidim::ActionDelegator::DelegatesVotesByQuestion

Inherits:
Query
  • Object
show all
Defined in:
app/queries/decidim/action_delegator/delegates_votes_by_question.rb

Instance Method Summary collapse

Constructor Details

#initialize(question) ⇒ DelegatesVotesByQuestion

Returns a new instance of DelegatesVotesByQuestion.



6
7
8
# File 'app/queries/decidim/action_delegator/delegates_votes_by_question.rb', line 6

def initialize(question)
  @question = question
end

Instance Method Details

#queryObject



10
11
12
13
14
15
# File 'app/queries/decidim/action_delegator/delegates_votes_by_question.rb', line 10

def query
  DelegationVotes.new.query
                 .merge(question.votes)
                 .merge(consultation_delegations)
                 .distinct.count(:granter_id)
end