Sha256: 77f4107e46842b28f7e43774317df9958cfd32da8aa5b0ce1887ae21dc426359
Contents?: true
Size: 657 Bytes
Versions: 19
Compression:
Stored size: 657 Bytes
Contents
# frozen_string_literal: true module Decidim module Elections module Admin # A class used to find election votes for statistics class VotesForStatistics < Decidim::Query # Syntactic sugar to initialize the class and return the queried object. def self.for(election) new(election).query end def initialize(election) @election = election end # Finds the votes for an election which get count for the statistics def query @election.votes.accepted.pick(Arel.sql("COUNT(id)"), Arel.sql("COUNT(distinct voter_id)")) end end end end end
Version data entries
19 entries across 19 versions & 1 rubygems