diff --git a/SAS/TMSS/backend/services/scheduling/lib/constraints.py b/SAS/TMSS/backend/services/scheduling/lib/constraints.py index 1b5833804fa794c0751a2ae0ca1a4b1257d5edb1..718c009921e32c36c12afa4f680f7cce98b2ff40 100644 --- a/SAS/TMSS/backend/services/scheduling/lib/constraints.py +++ b/SAS/TMSS/backend/services/scheduling/lib/constraints.py @@ -1889,7 +1889,7 @@ def get_blocking_scheduled_units(scheduling_unit: models.SchedulingUnitBlueprint # Third, loop over the small number of overlapping scheduled units, and only keep the ones sharing one or more stations candidate_stations = set(scheduling_unit.main_observation_stations) - observation_overlapping_scheduled_units = [s for s in overlapping_scheduled_units.all() + observation_overlapping_scheduled_units = [s for s in observation_overlapping_scheduled_units if any(set(s.main_observation_stations).intersection(candidate_stations))] # Finally, return the result as a queryset, so the caller can do furter queries on it.