mirror of
https://github.com/discourse/discourse.git
synced 2026-08-07 13:19:19 +08:00
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 |
||
|---|---|---|
| .. | ||
| discourse_calendar | ||
| discourse_post_event | ||
| tasks | ||
| calendar.rb | ||
| calendar_first_day_of_week.rb | ||
| calendar_settings_validator.rb | ||
| calendar_upcoming_events_default_view.rb | ||
| calendar_validator.rb | ||
| event_validator.rb | ||
| group_timezones.rb | ||
| holiday_status.rb | ||
| time_sniffer.rb | ||
| users_on_holiday.rb | ||