Class: Decidim::Elections::ElectionsReadyToStart

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

Overview

A class used to find elections ready and near to start the 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_ready_to_start.rb', line 8

def self.for
  new.query
end

Instance Method Details

#queryObject

Finds the Elections that should be opened.



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

def query
  Decidim::Elections::Election.bb_key_ceremony_ended
                              .where("start_time <= ?", minimum_start_time)
end