From b731731f4a2083aff40a6d574d05f05113866e89 Mon Sep 17 00:00:00 2001
From: Arnaud Levy <contact@arnaudlevy.com>
Date: Thu, 28 Dec 2023 09:03:49 +0100
Subject: [PATCH] Fix #1386

---
 app/models/communication/website/agenda/event.rb | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/app/models/communication/website/agenda/event.rb b/app/models/communication/website/agenda/event.rb
index a482b9fc9..0f56feab4 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
-- 
GitLab