diff --git a/SAS/TMSS/backend/src/tmss/tmssapp/views.py b/SAS/TMSS/backend/src/tmss/tmssapp/views.py index 53b19aaf6cd37446843ed427af51d49f284455a2..8291fe5a4cae1acff240ff6424d9364b1fdb91ec 100644 --- a/SAS/TMSS/backend/src/tmss/tmssapp/views.py +++ b/SAS/TMSS/backend/src/tmss/tmssapp/views.py @@ -757,10 +757,12 @@ def failure_report(request): def public_schedule(request): '''return the current and future running and scheduled units in either html table or json depending on the request accept header''' # get all current and future running and scheduled units - scheduled_or_running_units = models.SchedulingUnitBlueprint.objects.filter(status__value__in=models.SchedulingUnitStatus.ACTIVE_STATUS_VALUES) \ + scheduled_or_running_units = models.SchedulingUnitBlueprint.objects.prefetch_related('task_blueprints__specifications_template__type') \ + .select_related(models.SchedulingUnitBlueprint.path_to_project, 'status', 'specifications_template', 'specifications_template') \ + .filter(status__value__in=models.SchedulingUnitStatus.ACTIVE_STATUS_VALUES) \ .filter(obsolete_since__isnull=True) \ .filter(on_sky_stop_time__gte=datetime.utcnow()) \ - .order_by('on_sky_start_time').all() + .order_by('on_sky_start_time').all()[:3] # return json if requested if 'json' in request.headers.get('Accept','').lower():