diff --git a/.vs/AAWebPlatform/v15/.suo b/.vs/AAWebPlatform/v15/.suo index b594dc182..397fec305 100644 Binary files a/.vs/AAWebPlatform/v15/.suo and b/.vs/AAWebPlatform/v15/.suo differ diff --git a/FileCursor.js b/FileCursor.js index e40ebe367..5fa883888 100644 --- a/FileCursor.js +++ b/FileCursor.js @@ -240,13 +240,13 @@ function newFileCursor() { - function setDatetime(datetime) { + function setDatetime(datetime, callBackFunction) { if (datetime === undefined) { return; } cursorDate = datetime; - getFiles(); + getFiles(callBackFunction); collectGarbage(); } diff --git a/FileCursorCache.js b/FileCursorCache.js index 626616eef..d7e908eb3 100644 --- a/FileCursorCache.js +++ b/FileCursorCache.js @@ -18,10 +18,14 @@ function newFileCursorCache() { let marketFiles = new Map; let fileCursors = new Map; + let callBackWhenFileReceived; + return fileCursorCache; function initialize(pDevTeam, pBot, pProduct, pSet, pExchange, pMarket, pDatetime, pTimePeriod, callBackFunction) { + callBackWhenFileReceived = callBackFunction; + let exchange = ecosystem.getExchange(pProduct, pExchange); if (exchange === undefined) { @@ -49,16 +53,19 @@ function newFileCursorCache() { expectedFiles = expectedFiles + fileCursor.getExpectedFiles(); - function onFileReceived() { - - filesLoaded++; - callBackFunction(); // Note that the call back is called for every file loaded at each cursor. - - } } } } + function onFileReceived() { + + console.log("FileCursorCache -> onFileReceived") + + filesLoaded++; + callBackWhenFileReceived(); // Note that the call back is called for every file loaded at each cursor. + + } + function getFileCursor(pPeriod) { return fileCursors.get(pPeriod); @@ -67,13 +74,19 @@ function newFileCursorCache() { function setDatetime(pDatetime) { + filesLoaded = 0; + expectedFiles = 0; + fileCursors.forEach(setDatetimeToEach) - function setDatetimeToEach(value, key, map) { + function setDatetimeToEach(fileCursor, key, map) { - value.setDatetime(pDatetime); + fileCursor.setDatetime(pDatetime, onFileReceived); + expectedFiles = expectedFiles + fileCursor.getExpectedFiles(); } + + console.log("FileCursorCache -> setDatetime -> expectedFiles = " + expectedFiles) } function setTimePeriod(pTimePeriod) { diff --git a/ProductCard.js b/ProductCard.js index 6b73e15d5..ea23d9d35 100644 --- a/ProductCard.js +++ b/ProductCard.js @@ -1,6 +1,6 @@ function newProductCard() { - const CONSOLE_LOG = false; + const CONSOLE_LOG = true; var thisObject = { container: undefined, @@ -13,6 +13,7 @@ onMarketFileLoaded: onMarketFileLoaded, onDailyFileLoaded: onDailyFileLoaded, onSingleFileLoaded: onSingleFileLoaded, + onDayChanged: onDayChanged, getContainer: getContainer, // returns the inner most container that holds the point received by parameter. initialize: initialize }; @@ -116,6 +117,18 @@ } + function onDayChanged() { + + dailyFileProgressBar.animatedValue = 0; + + if (CONSOLE_LOG === true) { + + console.log("ProductCard -> onDayChanged"); + + } + + } + function onMarketFileLoaded(event) { if (event.currentValue === event.totalValue) { diff --git a/TimelineChart.js b/TimelineChart.js index bdf80acea..defe0c5e8 100644 --- a/TimelineChart.js +++ b/TimelineChart.js @@ -337,8 +337,29 @@ function newTimelineChart() { function setDatetime(pDatetime) { + /* If there is a change in the day, then we tell it to the Product Card so that it can represent the activity of the daily cursors on the UI. */ + + let currentDate = Math.trunc(datetime.valueOf() / ONE_DAY_IN_MILISECONDS); + let newDate = Math.trunc(newDatetime.valueOf() / ONE_DAY_IN_MILISECONDS); + datetime = pDatetime; + if (currentDate !== pDatetime) { + + if (timePeriod <= _1_HOUR_IN_MILISECONDS) { + + for (var i = 0; i < activePlotters.length; i++) { + + let activePlotter = activePlotters[i]; + activePlotter.productCard.onDayChanged(); + + } + + } + } + + /* No matter if the day changed or not, we need to inform all visible Plotters. */ + if (thisObject.container.frame.isInViewPort()) { for (var i = 0; i < activePlotters.length; i++) { diff --git a/server.js b/server.js index 39b6fecda..a780cdf8c 100644 --- a/server.js +++ b/server.js @@ -6,7 +6,7 @@ if (CONSOLE_LOG === true) { } -let debugMode = false; // This forces the server to read Plotters from the local drive. +let debugMode = true; // This forces the server to read Plotters from the local drive. if (CONSOLE_LOG === true && debugMode === true) {