0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-07 13:19:19 +08:00
discourse/plugins/discourse-calendar/lib
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
..
discourse_calendar DEV: Clean up scope resolution operators in plugins (#34979) 2025-09-30 14:36:34 +02:00
discourse_post_event FIX: event not found after being edited to earlier date (#36481) 2025-12-08 17:41:46 +01:00
tasks DEV: Fix javascript:update_constants task (#35994) 2025-11-12 20:01:29 +01:00
calendar.rb
calendar_first_day_of_week.rb FEATURE: allow picking first day of week in calendar (#34670) 2025-09-02 12:44:50 +02:00
calendar_settings_validator.rb
calendar_upcoming_events_default_view.rb FEATURE: adds calendar_upcoming_events_default_view setting (#36014) 2025-11-13 19:19:13 +08:00
calendar_validator.rb
event_validator.rb
group_timezones.rb
holiday_status.rb DEV: Update rubocop-discourse to 3.13 and autofix issues (#35073) 2025-10-06 16:11:01 +02:00
time_sniffer.rb
users_on_holiday.rb