Sha256: 66975f6f9828fbee7080c24590e78cda1e2000d0f76b8599c9d4dbfe30091734

Contents?: true

Size: 572 Bytes

Versions: 6

Compression:

Stored size: 572 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Elections
    module Votes
      # A class used to find votes for a specific user and election
      class UserElectionLastVote < Rectify::Query
        def initialize(user, election)
          @user = user
          @election = election
        end

        def query
          Rectify::Query
            .merge(
              ElectionVotes.new(@election),
              UserVotes.new(@user)
            )
            .query
            .order("created_at")
            .last
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-elections-0.24.3 app/queries/decidim/elections/votes/user_election_last_vote.rb
decidim-elections-0.24.2 app/queries/decidim/elections/votes/user_election_last_vote.rb
decidim-elections-0.24.1 app/queries/decidim/elections/votes/user_election_last_vote.rb
decidim-elections-0.24.0 app/queries/decidim/elections/votes/user_election_last_vote.rb
decidim-elections-0.24.0.rc2 app/queries/decidim/elections/votes/user_election_last_vote.rb
decidim-elections-0.24.0.rc1 app/queries/decidim/elections/votes/user_election_last_vote.rb