diff --git a/app/models/communication/website/agenda/event.rb b/app/models/communication/website/agenda/event.rb index a482b9fc91be146ed84a46c8c6ca1297c01dc95c..0f56feab4fcf69fbaa6c8915e64ff82d6daeeed2 100644 --- a/app/models/communication/website/agenda/event.rb +++ b/app/models/communication/website/agenda/event.rb @@ -83,6 +83,8 @@ class Communication::Website::Agenda::Event < ApplicationRecord validates_presence_of :from_day, :title validate :to_day_after_from_day, :to_hour_after_from_hour_on_same_day + before_validation :set_to_day + STATUS_FUTURE = 'future' STATUS_CURRENT = 'current' STATUS_ARCHIVE = 'archive' @@ -218,4 +220,8 @@ class Communication::Website::Agenda::Event < ApplicationRecord def abouts_with_agenda_block website.blocks.agenda.collect(&:about) end + + def set_to_day + self.to_day = self.from_day if self.to_day.nil? + end end