From c4ce7debb16fe59c8f997d87da4c106bbbca423f Mon Sep 17 00:00:00 2001
From: Jorrit Schaap <schaap@astron.nl>
Date: Wed, 24 Nov 2021 14:53:21 +0100
Subject: [PATCH] TMSS-only consider active projects

---
 SAS/TMSS/backend/services/scheduling/lib/dynamic_scheduling.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/SAS/TMSS/backend/services/scheduling/lib/dynamic_scheduling.py b/SAS/TMSS/backend/services/scheduling/lib/dynamic_scheduling.py
index 068bc98fc00..89416f722c1 100644
--- a/SAS/TMSS/backend/services/scheduling/lib/dynamic_scheduling.py
+++ b/SAS/TMSS/backend/services/scheduling/lib/dynamic_scheduling.py
@@ -92,6 +92,9 @@ def schedule_manual_scheduling_units():
     # get the manually schedulable scheduling_units in most-recently-updated order.
     schedulable_units = get_manually_schedulable_scheduling_units()
 
+    # only consider active projects
+    schedulable_units = schedulable_units.filter(draft__scheduling_set__project__project_state_value=models.ProjectState.Choices.ACTIVE.value)
+
     logger.info("trying to schedule %s scheduling units with manual at constraint", schedulable_units.count())
 
     for schedulable_unit in schedulable_units:
-- 
GitLab