From 0bc2d66ebef75aca5402e008e3f3437a75e58be0 Mon Sep 17 00:00:00 2001
From: Jorrit Schaap <schaap@astron.nl>
Date: Mon, 26 Apr 2021 09:51:11 +0200
Subject: [PATCH] TMSS-717: quick fix: for estimating the
 earliest_possible_start_time, we need the full duration of the scheduling
 unit, not just the longest one.

---
 .../scheduling/lib/constraints/template_constraints_v1.py      | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/SAS/TMSS/backend/services/scheduling/lib/constraints/template_constraints_v1.py b/SAS/TMSS/backend/services/scheduling/lib/constraints/template_constraints_v1.py
index bbef33f9c63..a67d5e1fdd9 100644
--- a/SAS/TMSS/backend/services/scheduling/lib/constraints/template_constraints_v1.py
+++ b/SAS/TMSS/backend/services/scheduling/lib/constraints/template_constraints_v1.py
@@ -329,7 +329,8 @@ def get_longest_observation_task_name_from_requirements_doc(scheduling_unit: mod
 def get_earliest_possible_start_time(scheduling_unit: models.SchedulingUnitBlueprint, lower_bound: datetime) -> datetime:
     constraints = scheduling_unit.draft.scheduling_constraints_doc
 
-    main_observation_task_name = get_target_observation_task_name_from_requirements_doc(scheduling_unit)
+    # TODO: for estimating the earliest_possible_start_time, we need the full duration of the scheduling unit, not just the longest one.
+    main_observation_task_name = get_longest_observation_task_name_from_requirements_doc(scheduling_unit)
     duration = timedelta(seconds=scheduling_unit.requirements_doc['tasks'][main_observation_task_name]['specifications_doc']['duration'])
     try:
         if 'at' in constraints['time']:
-- 
GitLab