From e22c00c4bebcd480de082c10b4e6ca5e11f49516 Mon Sep 17 00:00:00 2001
From: Jorrit Schaap <schaap@astron.nl>
Date: Tue, 24 Oct 2023 10:05:27 +0200
Subject: [PATCH] for nice visual feedback to the user, move each old
 schedulable unit to the lower_bound

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

diff --git a/SAS/TMSS/backend/services/scheduling/lib/dynamic_scheduling.py b/SAS/TMSS/backend/services/scheduling/lib/dynamic_scheduling.py
index c46aa94ae67..545661e70b2 100644
--- a/SAS/TMSS/backend/services/scheduling/lib/dynamic_scheduling.py
+++ b/SAS/TMSS/backend/services/scheduling/lib/dynamic_scheduling.py
@@ -351,6 +351,11 @@ class Scheduler:
                         # just advance
                         lower_bound += timedelta(hours=3)
 
+                    # for nice "visual" feedback to the user, move each "old" schedulable unit to the lower_bound
+                    # this also indicates to the user that the unit has been considered for times < lower_bound, and they could not be scheduled there.
+                    for unit in get_dynamically_schedulable_scheduling_units().filter(scheduled_start_time__lt=lower_bound).all():
+                        update_subtasks_start_times_for_scheduling_unit(unit, lower_bound)
+
                 # any units left to be scheduled? If so, loop again, else break out of while loop
                 if not get_dynamically_schedulable_scheduling_units().exists():
                     # there are no more schedulable units. check to-be-re-evaluated scheduled future units.
-- 
GitLab