app/models/tramway/event/event.rb in tramway-event-1.9.27.6 vs app/models/tramway/event/event.rb in tramway-event-1.9.28
- old
+ new
@@ -12,10 +12,10 @@
has_and_belongs_to_many :places
enumerize :status, default: :common, in: %i[common main]
scope :main_event, -> { active.where(status: :main) }
- scope :actual, -> { where 'end_date > ?', DateTime.now }
+ scope :actual, -> { order(:begin_date).where('end_date > ?', DateTime.now) }
scope :past, -> { where 'end_date < ?', DateTime.now }
def request_collecting_state
return :not_initialized unless request_collecting_begin_date.present? || request_collecting_end_date.present?
return :will_begin_soon if request_collecting_begin_date > DateTime.now