0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-09 20:33:03 +08:00
discourse/plugins/discourse-calendar/lib/discourse_post_event
Régis Hanol c50076c4f4
FIX: event not found after being edited to earlier date (#36481)
Events edited to earlier dates weren't being found correctly because
the ordering logic for determining the "current" event date was
duplicated and inconsistent between the Event model and EventFinder.

Centralizes the ordering logic in EventDate.current_ordering_sql which
prioritizes pending dates (finished_at IS NULL) first, then orders by
starts_at DESC for pending dates or updated_at DESC for finished dates.

- Added `current_first` scope to EventDate using the shared ordering SQL
- Refactored `current_event_date` in Event to use the scope (with
  in-memory fallback when association is loaded to avoid N+1 queries)
- Updated EventFinder to reference the same ordering SQL
- Updated database index to support the new ordering efficiently

Bug report - https://meta.discourse.org/t/date-range-seems-wrong/389891
2025-12-08 17:41:46 +01:00
..
engine.rb
event_finder.rb FIX: event not found after being edited to earlier date (#36481) 2025-12-08 17:41:46 +01:00
event_parser.rb FEATURE: introduce max attendees for events (#34313) 2025-09-01 22:56:19 +02:00
event_validator.rb
export_csv_controller_extension.rb
export_csv_file_extension.rb
post_extension.rb
rrule_configurator.rb FIX: removes support for include_expired param (#34582) 2025-08-28 14:37:45 +02:00
rrule_generator.rb FIX: maintain wall clock time between DST transitions (#35833) 2025-11-07 13:25:56 +01:00