app/models/tramway/event/event.rb in tramway-event-1.7.2 vs app/models/tramway/event/event.rb in tramway-event-1.8
- old
+ new
@@ -7,6 +7,13 @@
has_many :partakings, as: :part, class_name: 'Tramway::Event::Partaking'
enumerize :status, default: :common, in: [ :common, :main ]
scope :main_event, -> { where(status: :main) }
+
+ 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
+ return :is_over if request_collecting_end_date < DateTime.now
+ return :are_being_right_now if request_collecting_begin_date&.<(DateTime.now) && request_collecting_end_date&.>(DateTime.now)
+ end
end