diff --git a/epictrack-api/src/api/services/event.py b/epictrack-api/src/api/services/event.py index 0e46eb298..467bc9ecc 100644 --- a/epictrack-api/src/api/services/event.py +++ b/epictrack-api/src/api/services/event.py @@ -1177,7 +1177,10 @@ def _post_process_actions(cls, source_event: Event): all_work_phases = sorted(all_work_phases, key=lambda x: x.sort_order) work = source_event.work # if it is same, no need to do unwanted update - if work.current_work_phase_id != all_work_phases[0].id: + if ( + len(all_work_phases) > 0 + and work.current_work_phase_id != all_work_phases[0].id + ): work.current_work_phase = all_work_phases[0] work.update(work.as_dict(recursive=False), commit=False)