First Part Retrieving loading from file cursors
This commit is contained in:
1 parent
9e2b599672
commit
7dea1b0618
6 files changed
+59
-12
No files matched your search
Binary file not shown.
+2
-2
@@ -240,13 +240,13 @@ function newFileCursor() {
|
||||
|
||||
|
||||
|
||||
function setDatetime(datetime) {
|
||||
function setDatetime(datetime, callBackFunction) {
|
||||
|
||||
if (datetime === undefined) { return; }
|
||||
|
||||
cursorDate = datetime;
|
||||
|
||||
getFiles();
|
||||
getFiles(callBackFunction);
|
||||
|
||||
collectGarbage();
|
||||
}
|
||||
|
||||
+21
-8
@@ -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) {
|
||||
|
||||
+14
-1
@@ -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) {
|
||||
|
||||
@@ -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++) {
|
||||
|
||||
Reference in new issue
Block a user