Add recounting Poll scope with trait and spec
This commit is contained in:
@@ -25,6 +25,7 @@ class Poll < ActiveRecord::Base
|
||||
scope :current, -> { where('starts_at <= ? and ? <= ends_at', Date.current.beginning_of_day, Date.current.beginning_of_day) }
|
||||
scope :incoming, -> { where('? < starts_at', Date.current.beginning_of_day) }
|
||||
scope :expired, -> { where('ends_at < ?', Date.current.beginning_of_day) }
|
||||
scope :recounting, -> { Poll.where(ends_at: (Date.current.beginning_of_day - RECOUNT_DURATION)..Date.current.beginning_of_day) }
|
||||
scope :published, -> { where('published = ?', true) }
|
||||
scope :by_geozone_id, ->(geozone_id) { where(geozones: {id: geozone_id}.joins(:geozones)) }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user