Class: Decidim::Elections::ElectionsReadyToStart

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

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_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 'decidim-elections/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