diff --git a/app/models/communication/website/agenda/event/localization.rb b/app/models/communication/website/agenda/event/localization.rb index 0417f7cd1..1242c967b 100644 --- a/app/models/communication/website/agenda/event/localization.rb +++ b/app/models/communication/website/agenda/event/localization.rb @@ -76,7 +76,6 @@ class Communication::Website::Agenda::Event::Localization < ApplicationRecord :time_zone, :kind_simple?, :kind_recurring?, - :kind_parent?, :kind_child?, to: :event @@ -106,7 +105,7 @@ def should_sync_to?(website) website.active_language_ids.include?(language_id) && published? && event.time_slots.none? && # Rendered by Communication::Website::Agenda::Event::TimeSlot - event.children.none? # Rendered by Communication::Website::Agenda::Event::Day + children.published.none? # Rendered by Communication::Website::Agenda::Event::Day end def template_static @@ -136,10 +135,16 @@ def parent event.parent&.localization_for(language) end + # If there's no published children, it's a simple event + # https://github.com/osunyorg/gaitelyrique-www/issues/139 + def kind_parent? + children.published.any? + end + def hugo(website) if event.time_slots.any? hugo_for_time_slots(website) - elsif event.kind_parent? + elsif kind_parent? hugo_for_parent(website) else super(website) diff --git a/app/models/communication/website/agenda/event/with_kinds.rb b/app/models/communication/website/agenda/event/with_kinds.rb index b07d4fdaf..2364ad4fd 100644 --- a/app/models/communication/website/agenda/event/with_kinds.rb +++ b/app/models/communication/website/agenda/event/with_kinds.rb @@ -41,7 +41,6 @@ def kind end end - def kind_simple? children.none? && !multiple_time_slots? end