Sha256: e356a1f85228bcb1aff7852a77a24baf15522cffa0baddb3f7360670898da2a2
Contents?: true
Size: 664 Bytes
Versions: 6
Compression:
Stored size: 664 Bytes
Contents
# frozen_string_literal: true module Decidim module Elections module Admin # A class used to find election votes for statistics class VotesForStatistics < Rectify::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.pluck(Arel.sql("COUNT(id)"), Arel.sql("COUNT(distinct voter_id)")).first end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems