Sha256: 1a1793e32faf091cce4b12774bcc3b3fb9d31a808529718b63e3f92208d8bf45

Contents?: true

Size: 695 Bytes

Versions: 1

Compression:

Stored size: 695 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module ActionDelegator
    class TypeAndWeight < Decidim::Query
      def initialize(consultation)
        @consultation = consultation
      end

      def query
        relation = VotedWithPonderations.new(published_questions_responses).query
        ResponsesByMembership.new(relation).query
      end

      private

      attr_reader :consultation

      # Returns the published questions' responses of the given consultation as an ActiveRecord
      # Relation. Note this enables us to the chain it with other AR Relation objects.
      def published_questions_responses
        Responses.new(consultation).query
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
decidim-action_delegator-0.8.1 app/queries/decidim/action_delegator/type_and_weight.rb