Sha256: ee43d07c3658e1f1571b741b60b229abe2ae3d9f822fa6666df70ef66fe5dec6

Contents?: true

Size: 710 Bytes

Versions: 4

Compression:

Stored size: 710 Bytes

Contents

# frozen_string_literal: true

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

      def query
        relation = VotedWithDirectVerification.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
        PublishedResponses.new(consultation).query
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
decidim-action_delegator-0.6.0 app/queries/decidim/action_delegator/type_and_weight.rb
decidim-action_delegator-0.5.0 app/queries/decidim/action_delegator/type_and_weight.rb
decidim-action_delegator-0.4.1 app/queries/decidim/action_delegator/type_and_weight.rb
decidim-action_delegator-0.4 app/queries/decidim/action_delegator/type_and_weight.rb