From d94b27d55b1a69511b86dd8d021e2f349067a94f Mon Sep 17 00:00:00 2001
From: unknown <n.santhanam@redkarma.eu>
Date: Wed, 21 Oct 2020 22:00:34 +0530
Subject: [PATCH] TMSS-289

Time Constraints updated
---
 .../src/routes/Scheduling/Scheduling.Constraints.js       | 6 ++++++
 .../frontend/tmss_webapp/src/routes/Scheduling/create.js  | 8 ++++----
 .../frontend/tmss_webapp/src/routes/Scheduling/edit.js    | 6 ++++++
 3 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/Scheduling.Constraints.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/Scheduling.Constraints.js
index 391378c4b95..52ebcb8b12c 100644
--- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/Scheduling.Constraints.js
+++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/Scheduling.Constraints.js
@@ -151,6 +151,12 @@ export default (props) => {
       if (!initValue.time.at) {
           initValue.time.at= '';
        }
+       if (!initValue.time.after) {
+        initValue.time.after= '';
+       }
+       if (!initValue.time.before) {
+        initValue.time.before= '';
+       }
      
        /*   for (let type in initValue.sky.transit_offset) {
             initValue.sky.transit_offset[type] = initValue.sky.transit_offset[type] / 60;
diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/create.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/create.js
index 1d64b1f0cab..efd6ddf088b 100644
--- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/create.js
+++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/create.js
@@ -289,11 +289,11 @@ export class SchedulingUnitCreate extends Component {
         for (let type in constStrategy.time) {
             if (constStrategy.scheduler === 'online') {
                 delete constStrategy.time.at;
+            }
+            if (!constStrategy.time.after) {
                 delete constStrategy.time.after;
-                delete constStrategy.time.before;
-             }
-             if (constStrategy.scheduler === 'manual') {
-                delete constStrategy.time.after;
+            }
+            if (!constStrategy.time.before) {
                 delete constStrategy.time.before;
              }
             if (constStrategy.time[type] && constStrategy.time[type].length) {
diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/edit.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/edit.js
index 4768491055d..2064df3514f 100644
--- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/edit.js
+++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/edit.js
@@ -273,7 +273,13 @@ export class EditSchedulingUnit extends Component {
             if (constStrategy.scheduler === 'online') {
                 // For deleting property
                 delete constStrategy.time.at;
+             }
+             if (!constStrategy.time.after) {
+                delete constStrategy.time.after;
             }
+            if (!constStrategy.time.before) {
+                delete constStrategy.time.before;
+             }
             for (let type in constStrategy.time) {
                 if (constStrategy.time[type] && constStrategy.time[type].length) {
                     if (typeof constStrategy.time[type] === 'string') {
-- 
GitLab