Sha256: 527b9c15e8c2bc2e7f2492f681da9151f597cc9c19d1a5bb65f7c4c8e3ee92a6

Contents?: true

Size: 989 Bytes

Versions: 8

Compression:

Stored size: 989 Bytes

Contents

# frozen_string_literal: true

# Recreate validations to take into account custom fields and ignore the length limit in proposals
module Decidim
  module ActionDelegator
    module Consultations
      module MultipleVoteQuestionOverride
        extend ActiveSupport::Concern
        include VoteQuestionOverride

        included do
          private

          def create_vote!(vote_form)
            vote = if delegation
                     form.context.delegation = delegation
                     Decidim::ActionDelegator::VoteDelegation.new(vote_form.response, form.context).call
                   else
                     normal_vote = form.context.current_question.votes.build(
                       author: @current_user,
                       response: vote_form.response
                     )
                     Decidim::ActionDelegator::UnversionedVote.new(normal_vote)
                   end
            vote.save!
          end
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
decidim-action_delegator-0.8.1 app/commands/concerns/decidim/action_delegator/consultations/multiple_vote_question_override.rb
decidim-action_delegator-0.7.2 app/commands/concerns/decidim/action_delegator/consultations/multiple_vote_question_override.rb
decidim-action_delegator-0.7.1 app/commands/concerns/decidim/action_delegator/consultations/multiple_vote_question_override.rb
decidim-action_delegator-0.7.0 app/commands/concerns/decidim/action_delegator/consultations/multiple_vote_question_override.rb
decidim-action_delegator-0.6.0 app/commands/decidim/action_delegator/consultations/multiple_vote_question_override.rb
decidim-action_delegator-0.5.0 app/commands/decidim/action_delegator/consultations/multiple_vote_question_override.rb
decidim-action_delegator-0.4.1 app/commands/decidim/action_delegator/consultations/multiple_vote_question_override.rb
decidim-action_delegator-0.4 app/commands/decidim/action_delegator/consultations/multiple_vote_question_override.rb