Class: Decidim::Elections::ElectionsFinishedToEnd

Inherits:
Rectify::Query
  • Object
show all
Defined in:
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

Class Method Details

.forObject

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



8
9
10
# File '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 'app/queries/decidim/elections/elections_finished_to_end.rb', line 13

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