diff --git a/epictrack-api/src/api/services/event.py b/epictrack-api/src/api/services/event.py index b41f2a2e7..7cce7cc8f 100644 --- a/epictrack-api/src/api/services/event.py +++ b/epictrack-api/src/api/services/event.py @@ -403,7 +403,7 @@ def _previous_event_acutal_date_rule( ) ) phase_events = sorted( - phase_events, key=lambda x: x.id + phase_events, key=lambda x: x.actual_date or x.anticipated_date ) event_index = -1 for index, item in enumerate(phase_events):