Skip to content
Snippets Groups Projects
Commit e6460959 authored by Reinder Kraaij's avatar Reinder Kraaij :eye:
Browse files

improve GetStationLst

parent 74566fbc
No related branches found
No related tags found
2 merge requests!1213Resolve TMSS-2717 "Refactor details summary + ui tweaks",!1212Resolve TMSS-2717 "Refactor details summary + ui tweaks"
......@@ -204,23 +204,23 @@ export async function getCursorDateTimes(cursorTimeUTC, groupIndex, groupDate, l
let corelst = cursorDateTimeCoreLST.format("HH:mm");
let stationlst = await GetStationLst(isSingleStation, cursorDateTimeUTC, stationName);
let cursordatetimes = { utc, corelst, stationlst }
setCursorDateTimes(cursordatetimes)
setCursorDateTimes(cursordatetimes)
}
async function GetStationLst(isSingleStation, cursorDateTimeUTC, stationName) {
async function GetStationLst(isSingleStation, cursorDateTimeUTC, stationName) {
if (!isSingleStation) return;
let lststationshiftSeconds = 0;
let lststationshiftSeconds = -2;
let key = cursorDateTimeUTC.format(UIConstants.CALENDAR_GROUPING_FORMAT) + "_" + stationName; // we cache on a daily base
if (key in timecache) {
if (!timecache[key].isRetrieved) { return "...";}
if (!timecache[key].isRetrieved) { return "..."; }
lststationshiftSeconds = timecache[key].shift;
}
else {
timecache[key] = {isRetrieved:false};
lststationshiftSeconds = await fetchLSTStationShift(cursorDateTimeUTC, stationName);
timecache[key] = {isRetrieved:true, shift:lststationshiftSeconds};
}
if (lststationshiftSeconds <= 0) {
timecache[key] = { isRetrieved: false };
lststationshiftSeconds = await fetchLSTStationShift(cursorDateTimeUTC, stationName);
timecache[key] = { isRetrieved: true, shift: lststationshiftSeconds };
}
lststationshiftSeconds = moment(cursorDateTimeUTC).add(lststationshiftSeconds, 'second');
const stationlst = lststationshiftSeconds.format("HH:mm");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment