Class: Decidim::Elections::ElectionsFinishedToEnd

Inherits:
Query
  • Object
show all
Defined in:
decidim-elections/app/queries/decidim/elections/elections_finished_to_end.rb

Overview

A class used to find elections finished to close their voting period

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Query

#cached_query, #each, #eager?, #exists?, #initialize, merge, #none?, #relation?, #|

Constructor Details

This class inherits a constructor from Decidim::Query

Class Method Details

.forObject

Syntactic sugar to initialize the class and return the queried objects.



8
9
10
# File 'decidim-elections/app/queries/decidim/elections/elections_finished_to_end.rb', line 8

def self.for
  new.query
end

Instance Method Details

#queryObject

Finds the Elections that should be closed.



13
14
15
16
# File 'decidim-elections/app/queries/decidim/elections/elections_finished_to_end.rb', line 13

def query
  Decidim::Elections::Election.bb_vote
                              .where("end_time <= ?", Time.current)
end