From 8c44d35563c7856b4a20681eaf3ba6ef3e78da57 Mon Sep 17 00:00:00 2001
From: Fanna Lautenbach <lautenbach@astron.nl>
Date: Tue, 12 Sep 2023 18:41:34 +0200
Subject: [PATCH] put start/stop times + control ID back in summary task list

---
 .../src/routes/Scheduling/summary.js          |  6 +++---
 .../routes/Timeline/data/week.view.data.js    | 21 ++++++++++++++++++-
 .../Timeline/helpers/week.view.helper.js      | 19 -----------------
 3 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/summary.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/summary.js
index 6b7438a14cf..f53cf5544e3 100644
--- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/summary.js
+++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/summary.js
@@ -418,9 +418,9 @@ export class SchedulingUnitSummary extends Component {
                             <ViewTable
                                 data={schedulingUnit.task_blueprints}
                                 defaultcolumns={[{id: "ID", name: "Name", short_description: "Short Description" ,
-                                                    typeValue:"Type", controlId: 'Control ID',
-                                                    start_time:{name:"Start Time", format:UIConstants.CALENDAR_DATETIME_FORMAT},
-                                                    stop_time:{name:"End Time", format:UIConstants.CALENDAR_DATETIME_FORMAT},
+                                                    typeValue:"Type", subtasks_ids: 'Control ID',
+                                                    scheduled_start_time:{name:"Start Time", format:UIConstants.CALENDAR_DATETIME_FORMAT},
+                                                    scheduled_stop_time:{name:"End Time", format:UIConstants.CALENDAR_DATETIME_FORMAT},
                                                     status: {name:"Status", showTag: true, tagClass: 'su-$dynamic$'}, unschedulable_reason: {name:"Unschedulable Reason"}, obsolete: 'Obsolete'}]}
                                 optionalcolumns={[{actionpath: "actionpath"}]}
                                 columnclassname={[{"ID": "filter-input-50","Name":"filter-input-75","Type":"filter-input-75","Control ID":"filter-input-75", "Start Time": "filter-input-75", "End Time": "filter-input-75",
diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/data/week.view.data.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/data/week.view.data.js
index bcec1a5b485..0600c5eabdc 100644
--- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/data/week.view.data.js
+++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/data/week.view.data.js
@@ -1,7 +1,6 @@
 import UIConstants from "../../../utils/ui.constants";
 import ScheduleService from "../../../services/schedule.service";
 import {
-    addNestedBlueprintInformation,
     enhanceReservations,
     enhanceSchedulingUnitData
 } from "../helpers/week.view.helper";
@@ -10,6 +9,7 @@ import AuthUtil from "../../../utils/auth.util";
 import UtilService from "../../../services/util.service";
 import {getSunTimingItems} from "../helpers/timeline.item.helper";
 import moment from "moment/moment";
+import TaskService from "../../../services/task.service";
 
 export async function fetchTimelineData(startTime, endTime, timelineCommonUtils, setData) {
     const from = startTime.format(UIConstants.CALENDAR_DATETIME_FORMAT);
@@ -74,6 +74,25 @@ export async function fetchLSTShift(startTime, setHeaderSettings) {
     }))
 }
 
+async function addNestedBlueprintInformation(suBluePrint, timelineCommonUtils) {
+    let missingStations = []
+    for (let taskIndex = 0; taskIndex < suBluePrint.task_blueprints.length; taskIndex++) {
+        const task = suBluePrint.task_blueprints[taskIndex]
+        let subtasksSpecifications = []
+        for (const subtaskId of task.subtasks_ids) {
+            subtasksSpecifications.push(await TaskService.getSubtaskDetails(subtaskId, "specifications_doc"))
+            const foundMissingStations = await TaskService.getSubtaskMissingStations(subtaskId);
+            missingStations = missingStations.concat(foundMissingStations.filter((item) => missingStations.indexOf(item) < 0))
+        }
+        suBluePrint.task_blueprints[taskIndex].subtasks = subtasksSpecifications
+    }
+    suBluePrint.stations = timelineCommonUtils.getSUStations(suBluePrint);
+    suBluePrint.missingStations = missingStations
+
+    const projectInfo = await ScheduleService.getSchedulingSet(suBluePrint.draft.scheduling_set_id, "project_id")
+    suBluePrint.project = projectInfo.project_id;
+}
+
 export async function fetchSUSummaryInformation(id, timelineCommonUtils, setSummarySettings) {
     let suBluePrint = await ScheduleService.getBlueprintByschedulingUnitId(id, "task_blueprints,draft")
     await addNestedBlueprintInformation(suBluePrint, timelineCommonUtils);
diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/helpers/week.view.helper.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/helpers/week.view.helper.js
index e2303feaa8a..6d35aa46274 100644
--- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/helpers/week.view.helper.js
+++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/helpers/week.view.helper.js
@@ -1,8 +1,6 @@
 import moment from "moment/moment";
 import UIConstants from "../../../utils/ui.constants";
-import ScheduleService from "../../../services/schedule.service";
 import UtilService from "../../../services/util.service";
-import TaskService from "../../../services/task.service";
 
 export function createGroups(startTime, amountOfGroups = 7) {
     const groups = []
@@ -212,24 +210,7 @@ export function enhanceReservations(reservations, timelineCommonUtils) {
     })
 }
 
-export async function addNestedBlueprintInformation(suBluePrint, timelineCommonUtils) {//TODO: backend requests
-    let missingStations = []
-    for (let taskIndex = 0; taskIndex < suBluePrint.task_blueprints.length; taskIndex++) {
-        const task = suBluePrint.task_blueprints[taskIndex]
-        let subtasksSpecifications = []
-        for (const subtaskId of task.subtasks_ids) {
-            subtasksSpecifications.push(await TaskService.getSubtaskDetails(subtaskId, "specifications_doc"))
-            const foundMissingStations = await TaskService.getSubtaskMissingStations(subtaskId);
-            missingStations = missingStations.concat(foundMissingStations.filter((item) => missingStations.indexOf(item) < 0))
-        }
-        suBluePrint.task_blueprints[taskIndex].subtasks = subtasksSpecifications
-    }
-    suBluePrint.stations = timelineCommonUtils.getSUStations(suBluePrint);
-    suBluePrint.missingStations = missingStations
 
-    const projectInfo = await ScheduleService.getSchedulingSet(suBluePrint.draft.scheduling_set_id, "project_id")
-    suBluePrint.project = projectInfo.project_id;
-}
 
 export function getCursorDateTimes(cursorTimeUTC, groupIndex, groupDate, lstShiftInSeconds, setCursorDateTimes) {
     const cursorTime = moment(cursorTimeUTC).format(UIConstants.CALENDAR_TIME_FORMAT);
-- 
GitLab