diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/SchedulingUnitList.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/SchedulingUnitList.js index 3d97d4b68efe5d0adab240aa9cd431c0bcd5effb..c2b8dd2267ed422f99696ed80b638e91562ee9e0 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/SchedulingUnitList.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/SchedulingUnitList.js @@ -794,34 +794,34 @@ class SchedulingUnitList extends Component{ */ async addTargetColumns(schedulingUnits) { let dataLoadstatus = false; - await schedulingUnits.map(async su => { + for (let su of schedulingUnits) { su['priority_queue'] = su.priority_queue_value; su.taskDetails = su.type==="Draft"?su.task_drafts:su.task_blueprints; const targetObserv = su.taskDetails ? su.taskDetails.find(task => task.specifications_template.type_value==='observation' && (task.specifications_doc.SAPs || task.specifications_doc.target)) : null; su['priority_queue'] = su.priority_queue_value; if (targetObserv) { this.suTypeColumnToBeRemove = []; - let targetName = ''; - let targetAngle1 = ''; - let targetAngle2 = ''; - let targetRef = ''; + let targetNames = []; + let targetAngle1s = []; + let targetAngle2s = []; + let targetRefs = []; su['target_observation_sap'] = targetObserv.specifications_doc.target? targetObserv.specifications_doc.target.SAPs.length: targetObserv.specifications_doc.SAPs.length; let SAPs = targetObserv.specifications_doc.target? targetObserv.specifications_doc.target.SAPs: targetObserv.specifications_doc.SAPs for (const target of SAPs) { - targetName += target.name+'\n'; - targetAngle1 += UnitConverter.getAngleInput(target.digital_pointing.angle1)+'\n'; - targetAngle2 += UnitConverter.getAngleInput(target.digital_pointing.angle2)+'\n'; - targetRef += target.digital_pointing.direction_type+'\n'; + // targetNames.push(target.digital_pointing.target) ; + targetNames.push(target.name) ; + targetAngle1s.push(UnitConverter.getAngleInput(target.digital_pointing.angle1)); + targetAngle2s.push(UnitConverter.getAngleInput(target.digital_pointing.angle2, true)); + targetRefs.push(target.digital_pointing.direction_type); }; - su['targetName'] = await this.formatListToNewLineText(_.split(targetName, '\n')); - su['targetAngle1'] = await this.formatListToNewLineText(_.split(targetAngle1, '\n')); - su['targetAngle2'] = await this.formatListToNewLineText(_.split(targetAngle2, '\n')); - su['targetRef'] = await this.formatListToNewLineText(_.split(targetRef, '\n')); + su['targetName'] = this.formatListToNewLineText(targetNames); + su['targetAngle1'] = this.formatListToNewLineText(targetAngle1s); + su['targetAngle2'] = this.formatListToNewLineText(targetAngle2s); + su['targetRef'] = this.formatListToNewLineText(targetRefs); } else { su['target_observation_sap'] = 0; } - return su; - }); + } await this.setState({ scheduleunit: schedulingUnits, isLoading: false, loadingStatus: dataLoadstatus }); 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 85f49409c64edb6e561a45c74816782cd75f4eb6..b0afedca78429ddc834977a1b6b352ecdea13183 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/create.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/create.js @@ -401,12 +401,8 @@ export class SchedulingUnitCreate extends Component { } } if (constStrategy.sky.transit_offset) { - constStrategy.sky.transit_offset.from = UnitConversion.getHHmmssToSecs(constStrategy.sky.transit_offset.from)*(constStrategy.sky.transit_offset.fromoffset === '-'? -1:1); - constStrategy.sky.transit_offset.to = UnitConversion.getHHmmssToSecs(constStrategy.sky.transit_offset.to)*(constStrategy.sky.transit_offset.tooffset === '-'? -1:1); - delete constStrategy.sky.transit_offset.fromoffset; - delete constStrategy.sky.transit_offset.tooffset - delete this.constraintTemplates[0].schema.properties.sky.properties.transit_offset.properties.fromoffset; - delete this.constraintTemplates[0].schema.properties.sky.properties.transit_offset.properties.tooffset; + constStrategy.sky.transit_offset.from = UnitConversion.getHHmmssToSecs(constStrategy.sky.transit_offset.from); + constStrategy.sky.transit_offset.to = UnitConversion.getHHmmssToSecs(constStrategy.sky.transit_offset.to); } //station 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 602144c605297c8601214d4b36a8581c8358304e..50e40dc823a5df4faf6e6ac4bb39dc1234837ef5 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/edit.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/edit.js @@ -427,12 +427,8 @@ export class EditSchedulingUnit extends Component { } const schUnit = { ...this.state.schedulingUnit }; if (constStrategy.sky.transit_offset) { - constStrategy.sky.transit_offset.from = UnitConversion.getHHmmssToSecs(constStrategy.sky.transit_offset.from)*(constStrategy.sky.transit_offset.fromoffset === '-'? -1:1); - constStrategy.sky.transit_offset.to = UnitConversion.getHHmmssToSecs(constStrategy.sky.transit_offset.to)*(constStrategy.sky.transit_offset.tooffset === '-'? -1:1); - delete constStrategy.sky.transit_offset.fromoffset; - delete constStrategy.sky.transit_offset.tooffset - //delete this.constraintTemplates[0].schema.properties.sky.properties.transit_offset.properties.fromoffset; - //delete this.constraintTemplates[0].schema.properties.sky.properties.transit_offset.properties.tooffset; + constStrategy.sky.transit_offset.from = UnitConversion.getHHmmssToSecs(constStrategy.sky.transit_offset.from); + constStrategy.sky.transit_offset.to = UnitConversion.getHHmmssToSecs(constStrategy.sky.transit_offset.to); } schUnit.scheduling_constraints_doc = constStrategy; //station diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/view.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/view.js index ebe521e5ab00d89f05366a2cea8b33f65fb721aa..963bb552796a07bda456ef824bfcf86c94451bae 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/view.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/view.js @@ -192,8 +192,12 @@ export class TimelineView extends Component { }) } } - } - UnitConversion.degreeToRadians(constStrategy.sky); + } + if (constStrategy.sky.transit_offset) { + constStrategy.sky.transit_offset.from = UnitConversion.getHHmmssToSecs(constStrategy.sky.transit_offset.from); + constStrategy.sky.transit_offset.to = UnitConversion.getHHmmssToSecs(constStrategy.sky.transit_offset.to); + } + UnitConversion.degreeToRadians(constStrategy.sky); // getConstraintsEditorOutputService - service call is done for getting updated blueprint id const bluePrintValue = await ScheduleService.getConstraintsEditorOutputService(id); diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/week.view.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/week.view.js index d419a076858a7e554f5b3185ed27ebd250775d61..6760ca0a368098e853124ef3c0325e404c3eefa1 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/week.view.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/week.view.js @@ -181,8 +181,12 @@ export class WeekTimelineView extends Component { }) } } - } - UnitConversion.degreeToRadians(constStrategy.sky); + } + if (constStrategy.sky.transit_offset) { + constStrategy.sky.transit_offset.from = UnitConversion.getHHmmssToSecs(constStrategy.sky.transit_offset.from); + constStrategy.sky.transit_offset.to = UnitConversion.getHHmmssToSecs(constStrategy.sky.transit_offset.to); + } + UnitConversion.degreeToRadians(constStrategy.sky); // getConstraintsEditorOutputService - service call is done for getting updated blueprint id const bluePrintValue = await ScheduleService.getConstraintsEditorOutputService(id); diff --git a/SAS/TMSS/frontend/tmss_webapp/src/utils/unit.converter.js b/SAS/TMSS/frontend/tmss_webapp/src/utils/unit.converter.js index 22c07f6e8d3e8cf000ebf14ded24ea8951608792..345e6adbdfc27cbe75bfa9faaa768119b9e47260 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/utils/unit.converter.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/utils/unit.converter.js @@ -82,20 +82,13 @@ const UnitConverter = { } return seconds; }, - getHHmmssToSecs: function (seconds) { - if (seconds) { - seconds = _.trim(seconds); - const strSeconds = _.split(seconds, ":"); - let prefix = 1; - if (_.startsWith(strSeconds[0], '-')) { - prefix = -1; - const startPosition = strSeconds[0].indexOf("-"); - strSeconds[0] = strSeconds[0].substring(startPosition+1, strSeconds[0].length); - } else if (_.startsWith(strSeconds[0], '+')) { - const startPosition = strSeconds[0].indexOf("+"); - strSeconds[0] = strSeconds[0].substring(startPosition+1, strSeconds[0].length); - } - return strSeconds.length > 2 ?prefix * (_.trim(strSeconds[0]) * 3600 + strSeconds[1] * 60 + Number(strSeconds[2])): seconds; + getHHmmssToSecs: function (time) { + if (time) { + time = _.trim(time); + let prefix = _.startsWith(time, '-')?-1:1; + time = time.replace("-","").replace("+",""); + const strSeconds = _.split(time, ":"); + return prefix * (strSeconds[0] * 3600 + strSeconds[1] * 60 + Number(strSeconds[2])); } return 0; },