0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-06 13:08:40 +08:00
discourse/plugins/discourse-calendar/db/migrate
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
..
20190724181542_add_on_holiday_index.rb
20200226183018_create_calendar_events.rb
20200310200000_remove_timezone_custom_field.rb
20200327195549_add_topic_custom_field_post_event_date_index.rb
20200409102639_drop_incorrect_future_schema_migrations.rb
20200409102640_create_post_events_table.rb
20200409102641_create_invitees_table.rb
20200409102642_rename_setting_to_discourse_post_event.rb
20200409102643_rename_tables_to_discourse_post_event.rb
20200409120815_rename_topic_custom_field_topic_post_event_starts_at_index.rb
20200409181607_remove_display_invitees.rb
20200729094848_add_url_column_to_event.rb
20200805073343_drop_old_discourse_calendar_tables.rb
20200805133257_add_custom_fields_to_event.rb
20200809154642_create_reminders_table.rb
20200810185432_refactor_reminders.rb
20200810190429_drop_reminders_table.rb
20200812193122_add_recurrence_to_events.rb
20200926144256_add_unique_index_to_topic_event_ends_at_custom_field.rb
20201110225115_create_post_event_dates_table.rb
20201111005205_move_data_to_event_dates.rb DEV: Update rubocop-discourse to 3.13 and autofix issues (#35073) 2025-10-06 16:11:01 +02:00
20211216124303_add_timezone_to_calendar_events.rb
20220228163400_adds_timezone_to_discourse_post_event_event.rb
20220604200919_create_disabled_holidays.rb
20220613073844_unescape_event_name.rb
20220724130519_fix_post_event_timezones.rb
20221121165352_add_type_field_to_events_reminders.rb
20221223210225_add_minimal_option_to_calendar_event.rb
20231123233308_delete_duplicated_holidays.rb
20231124021939_delete_similar_holidays.rb
20240513140542_add_closed_to_discourse_post_event.rb
20250520042223_add_chat_fields_to_events.rb
20250526154632_add_recurrence_until.rb
20250602114410_add_show_local_time.rb
20250616101944_add_location_to_event.rb
20250616101945_add_description_to_event.rb
20250807042048_dedupe_event_schedules.rb
20250811120000_add_max_attendees_to_events.rb FEATURE: introduce max attendees for events (#34313) 2025-09-01 22:56:19 +02:00
20250819123417_remove_unusused_calendar_site_settings.rb DEV: full calendar v6 (#33737) 2025-08-26 10:35:05 +02:00
20250819123418_remove_include_expired_site_setting.rb FIX: removes support for include_expired param (#34582) 2025-08-28 14:37:45 +02:00
20250919094856_add_distinct_on_optimization_index_to_event_dates.rb PERF: correctly index event dates (#34877) 2025-09-19 17:41:57 +02:00
20251017115448_migrate_deprecated_holiday_region_codes.rb FIX: Job exception: Holidays::InvalidRegion (#35473) 2025-10-17 17:53:53 +02:00
20251205140527_update_event_dates_optimization_index.rb FIX: event not found after being edited to earlier date (#36481) 2025-12-08 17:41:46 +01:00