From be6dc81cb7889059bd8cf054a0d864bded8c99bd Mon Sep 17 00:00:00 2001
From: Jorrit Schaap <schaap@astron.nl>
Date: Tue, 12 Sep 2023 21:41:59 +0200
Subject: [PATCH] TMSS-2710 & TMSS-2593: do not map fixed
 process_start/stop_time on a new property start/stop_time when loaded, but
 select either the on_sky, or the process start/stop_time when displaying
 based on the shouldShowOnSkyTimes flag

---
 .../src/routes/Timeline/helpers/timeline.item.helper.js      | 4 ++--
 .../frontend/tmss_webapp/src/services/schedule.service.js    | 5 -----
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/helpers/timeline.item.helper.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/helpers/timeline.item.helper.js
index 06e1991dae1..5654d4cf98f 100644
--- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/helpers/timeline.item.helper.js
+++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/helpers/timeline.item.helper.js
@@ -176,8 +176,8 @@ export function groupRenderer({group}) {
 export function getTimelineItem(suBlueprint, displayDate, shouldShowOnSkyTimes = false) {
     const duration = `${(UnitConverter.getSecsToHrsWithFractionDigits(suBlueprint.duration))}Hrs`;
     const onSkyDuration = `${(UnitConverter.getSecsToHrsWithFractionDigits(suBlueprint.on_sky_duration))}Hrs`;
-    const startTimeWithDisplayDate = moment(`${displayDate.format('YYYY-MM-DD')} ${suBlueprint.start_time.split('T')[1]}`);
-    const endTimeWithDisplayDate = moment(`${displayDate.format('YYYY-MM-DD')} ${suBlueprint.stop_time.split('T')[1]}`)
+    const startTimeWithDisplayDate = moment(`${displayDate.format('YYYY-MM-DD')} ${suBlueprint.process_start_time.split('T')[1]}`);
+    const endTimeWithDisplayDate = moment(`${displayDate.format('YYYY-MM-DD')} ${suBlueprint.process_stop_time.split('T')[1]}`)
     const onSkyStartTimeWithDisplayDate = moment(`${displayDate.format('YYYY-MM-DD')} ${suBlueprint.on_sky_start_time.split('T')[1]}`);
     const onSkyEndTimeWithDisplayDate = moment(`${displayDate.format('YYYY-MM-DD')} ${suBlueprint.on_sky_stop_time.split('T')[1]}`)
     const band = suBlueprint.antennaSet ? suBlueprint.antennaSet.split("_")[0] : "" //Example: antenna sets LBA_OUTER -> band = LBA
diff --git a/SAS/TMSS/frontend/tmss_webapp/src/services/schedule.service.js b/SAS/TMSS/frontend/tmss_webapp/src/services/schedule.service.js
index 28609bc8ce0..5b56de5d962 100644
--- a/SAS/TMSS/frontend/tmss_webapp/src/services/schedule.service.js
+++ b/SAS/TMSS/frontend/tmss_webapp/src/services/schedule.service.js
@@ -153,11 +153,6 @@ const ScheduleService = {
                 let secondResponse = await axios.get(url);
                 blueprints = blueprints.concat(secondResponse.data.results);
             }
-            _.map(blueprints, su => {
-                su.start_time = su.process_start_time;
-                su.stop_time = su.process_stop_time;
-                return su;
-            });
             blueprints = blueprints.filter(su => su.status.toLowerCase() !== "obsolete")
         } catch (error) {
             console.error('[schedule.services.getExpandedSUList]', error);
-- 
GitLab