diff --git a/app/models/communication/website/agenda/event.rb b/app/models/communication/website/agenda/event.rb index 0a352ab599501d81c1ef06b4fabf2ac2eb311f73..912fb496b98f0ac1ce0e657bb5ea3da79e6a337b 100644 --- a/app/models/communication/website/agenda/event.rb +++ b/app/models/communication/website/agenda/event.rb @@ -172,18 +172,12 @@ class Communication::Website::Agenda::Event < ApplicationRecord end def to_time - if to_day.nil? && to_hour.nil? - # Pas de fin - nil - elsif to_day.nil? && to_hour.present? - # Heure de fin, donc on se base sur le jour de début - date_and_time(from_day, to_hour) - elsif to_day.present? && to_hour.nil? - # Jour de fin seul - to_day.to_time - elsif to_day.present? && to_hour.nil? - # Jour et heure de fin - date_and_time(to_day, to_hour) + if to_day.nil? + to_hour.nil? ? nil # Pas de fin, ni jour ni heure + : date_and_time(from_day, to_hour) # Heure de fin, donc on se base sur le jour de début + elsif to_day.present? + to_hour.nil? ? to_day.to_time # Jour de fin seul + : date_and_time(to_day, to_hour) # Jour et heure de fin end end