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 cbfc496aad5b5c4f7672aa56c324711e10c073b2..7d4e3957ce544d383ba83cb88b63cb3cd5f7117b 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 @@ -78,11 +78,16 @@ export async function fetchLSTStationShift(utcTime,station) { } let lstresponse = await UtilService.getLST(UTCTimeNow, stations) // we get timing also, makes debugging a lot easier. if (!lstresponse) return -1; + + let lststation = lstresponse.data?.LST?.[station]; + let UTCAlsoTimeNow = moment.utc(lstresponse.data?.UTC).format(UIConstants.UTC_DATE_TIME_FORMAT); + let lstcore = lstresponse.data?.LST?.[UIConstants.TIMINGSERVER]; + - let lst = lstresponse.data?.LST?.[station]; - let UTCAlsoTimeNow = moment.utc(lstresponse.data?.UTC).format(UIConstants.UTC_DATE_TIME_FORMAT); - const shift = GetLstShiftinSeconds(lst, UTCAlsoTimeNow) - return shift + const shiftLSTStation = GetLstShiftinSeconds(lststation, UTCAlsoTimeNow) + const shiftLSTCore = GetLstShiftinSeconds(lstcore, UTCAlsoTimeNow) + + return { shiftLSTStation, shiftLSTCore } } export async function fetchLSTShift(startTime, setHeaderSettings) { @@ -91,7 +96,7 @@ export async function fetchLSTShift(startTime, setHeaderSettings) { setHeaderSettings(prevState => ({ ...prevState, - lstShiftInSeconds: shift + lstShiftInSeconds: shift.shiftLSTCore })) } diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/helpers/timeline.renderer.helper.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/helpers/timeline.renderer.helper.js index 89faa599b8c230ceb58965eb49ae84d1737683c3..8e5979d94ee2e6926cb90089ac11c24624dae51b 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/helpers/timeline.renderer.helper.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/helpers/timeline.renderer.helper.js @@ -187,11 +187,11 @@ export function groupRenderer({ group }) { <tr><td>UTC</td><td> {group.cursorInfo.utc}</td></tr> {group.isSingleStation ? ( <tr> - <td>LST Station </td> - <td>{group.cursorInfo.stationlst}</td> + <td>LST {group.cursorInfo.stationName || 'Station' } </td> + <td>{group.cursorInfo.stationLST}</td> </tr> ) : null} - <tr><td>LST Core </td><td>{group.cursorInfo.corelst}</td></tr> + <tr><td>LST Core </td><td>{group.cursorInfo.coreLST}</td></tr> </tbody> </table> : null} </div>; 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 9b609b711381eda3c93501e14f7c22ba5bdeed73..e1073018cfef12904412f9838a32e92ac3dc5e98 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 @@ -200,31 +200,35 @@ export async function getCursorDateTimes(cursorTimeUTC, groupIndex, groupDate, l const cursorTime = moment(cursorTimeUTC) const cursorDateTimeUTC = moment(groupDate).set({ hour: cursorTime.get('hour'), minute: cursorTime.get('minute'), second: cursorTime.get('second') }); let utc = cursorDateTimeUTC.format("HH:mm"); - const cursorDateTimeCoreLST = moment(cursorDateTimeUTC).add(lstShiftInSeconds, 'second'); - let corelst = cursorDateTimeCoreLST.format("HH:mm"); - let stationlst = await GetStationLst(isSingleStation, cursorDateTimeUTC, stationName); - let cursordatetimes = { utc, corelst, stationlst } + let shifts = await GetStationLst(isSingleStation, cursorDateTimeUTC, stationName); + let coreLST = shifts.coreLST; + let stationLST = shifts.stationLST; + let cursordatetimes = { utc, coreLST, stationLST, stationName:stationName } setCursorDateTimes(cursordatetimes) } -async function GetStationLst(isSingleStation, cursorDateTimeUTC, stationName) { +async function GetStationLst(isSingleStation, cursorDateTimeUTC, stationName = UIConstants.TIMINGSERVER) { - if (!isSingleStation) return; let lststationshiftSeconds = -2; + let shift; let key = cursorDateTimeUTC.format(UIConstants.CALENDAR_GROUPING_FORMAT) + "_" + stationName; // we cache on a daily base if (key in timecache) { if (!timecache[key].isRetrieved) { return "..."; } - lststationshiftSeconds = timecache[key].shift; + shift = timecache[key].shift; + lststationshiftSeconds = shift.shiftLSTStation; } - if (lststationshiftSeconds <= 0) { + if (lststationshiftSeconds == -2) { timecache[key] = { isRetrieved: false }; - lststationshiftSeconds = await fetchLSTStationShift(cursorDateTimeUTC, stationName); - timecache[key] = { isRetrieved: true, shift: lststationshiftSeconds }; + shift = await fetchLSTStationShift(cursorDateTimeUTC, stationName); + timecache[key] = { isRetrieved: true, shift }; } - lststationshiftSeconds = moment(cursorDateTimeUTC).add(lststationshiftSeconds, 'second'); - const stationlst = lststationshiftSeconds.format("HH:mm"); - return stationlst; + const stationLST = moment(cursorDateTimeUTC).add(shift.shiftLSTStation, 'second').format("HH:mm");; + const coreLST = moment(cursorDateTimeUTC).add(shift.shiftLSTCore, 'second').format("HH:mm");; + + + + return { stationLST, coreLST }; }