app/models/tramway/event/event.rb in tramway-event-1.12.3.9 vs app/models/tramway/event/event.rb in tramway-event-1.12.3.10

- old
+ new

@@ -6,10 +6,12 @@ validate :check_dimensions def check_dimensions if photo.present? errors.add :photo, :too_small_image if photo.width.present? && (photo.width < 1920 || photo.height < 1080) + else + errors.add :photo, :is_not_present end end has_many :participants, class_name: 'Tramway::Event::Participant' has_many :participant_form_fields, -> { order(position: :asc) }, class_name: 'Tramway::Event::ParticipantFormField' @@ -20,10 +22,12 @@ has_many :actions, -> { order(id: :asc) }, class_name: 'Tramway::Event::Action' has_and_belongs_to_many :places enumerize :reach, default: :open, in: %i[open closed] - scope :actual, -> { where('begin_date > ?', DateTime.now).where('begin_date < ?', DateTime.now + 11.days).order(begin_date: :asc) } + scope :actual, -> do + where('begin_date > ?', DateTime.now).or(where('begin_date < ? AND end_date > ?', DateTime.now, DateTime.now)).order(begin_date: :asc) + end scope :past, -> { where 'end_date < ?', DateTime.now } scope :open, -> { where reach: :open } scope :closed, -> { where reach: :closed } validates :begin_date, presence: true