Cleaning Records when time Period changes
This commit is contained in:
1 parent
d253404dcf
commit
970c2e96cc
4 files changed
+26
-58
No files matched your search
+4
-10
@@ -185,21 +185,15 @@
|
||||
|
||||
try {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] setTimePeriod -> Entering function."); }
|
||||
|
||||
if (timePeriod !== pTimePeriod) {
|
||||
|
||||
timePeriod = pTimePeriod;
|
||||
|
||||
if (timePeriod >= _1_HOUR_IN_MILISECONDS) {
|
||||
|
||||
let newMarketFile = marketFiles.getFile(pTimePeriod);
|
||||
marketFile = marketFiles.getFile(pTimePeriod);
|
||||
|
||||
if (newMarketFile !== undefined) {
|
||||
|
||||
marketFile = newMarketFile;
|
||||
recalculate();
|
||||
}
|
||||
recalculate();
|
||||
|
||||
} else {
|
||||
|
||||
@@ -207,7 +201,7 @@
|
||||
|
||||
fileCursor = newFileCursor; // In this case, we explicitly want that if there is no valid cursor, we invalidate the data and show nothing.
|
||||
recalculate();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -265,7 +259,7 @@
|
||||
|
||||
try {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] recalculate -> Entering function."); }
|
||||
records = []
|
||||
|
||||
if (timePeriod >= _1_HOUR_IN_MILISECONDS) {
|
||||
|
||||
|
||||
+3
-9
@@ -193,21 +193,15 @@
|
||||
|
||||
try {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] setTimePeriod -> Entering function."); }
|
||||
|
||||
if (timePeriod !== pTimePeriod) {
|
||||
|
||||
timePeriod = pTimePeriod;
|
||||
|
||||
if (timePeriod >= _1_HOUR_IN_MILISECONDS) {
|
||||
|
||||
let newMarketFile = marketFiles.getFile(pTimePeriod);
|
||||
marketFile = marketFiles.getFile(pTimePeriod);
|
||||
|
||||
if (newMarketFile !== undefined) {
|
||||
|
||||
marketFile = newMarketFile;
|
||||
recalculate();
|
||||
}
|
||||
recalculate();
|
||||
|
||||
} else {
|
||||
|
||||
@@ -273,7 +267,7 @@
|
||||
|
||||
try {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] recalculate -> Entering function."); }
|
||||
records = []
|
||||
|
||||
if (timePeriod >= _1_HOUR_IN_MILISECONDS) {
|
||||
|
||||
|
||||
@@ -185,21 +185,15 @@
|
||||
|
||||
try {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] setTimePeriod -> Entering function."); }
|
||||
|
||||
if (timePeriod !== pTimePeriod) {
|
||||
|
||||
timePeriod = pTimePeriod;
|
||||
|
||||
if (timePeriod >= _1_HOUR_IN_MILISECONDS) {
|
||||
|
||||
let newMarketFile = marketFiles.getFile(pTimePeriod);
|
||||
marketFile = marketFiles.getFile(pTimePeriod);
|
||||
|
||||
if (newMarketFile !== undefined) {
|
||||
|
||||
marketFile = newMarketFile;
|
||||
recalculate();
|
||||
}
|
||||
recalculate();
|
||||
|
||||
} else {
|
||||
|
||||
@@ -265,7 +259,7 @@
|
||||
|
||||
try {
|
||||
|
||||
if (INFO_LOG === true) { logger.write("[INFO] recalculate -> Entering function."); }
|
||||
records = []
|
||||
|
||||
if (timePeriod >= _1_HOUR_IN_MILISECONDS) {
|
||||
|
||||
|
||||
+16
-30
@@ -151,27 +151,13 @@
|
||||
}
|
||||
|
||||
function getContainer(point) {
|
||||
|
||||
try {
|
||||
|
||||
let container;
|
||||
|
||||
/* First we check if this point is inside this space. */
|
||||
|
||||
if (this.container.frame.isThisPointHere(point) === true) {
|
||||
|
||||
return this.container;
|
||||
|
||||
} else {
|
||||
|
||||
/* This point does not belong to this space. */
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
|
||||
if (ERROR_LOG === true) { logger.write("[ERROR] getContainer -> err = " + err.stack); }
|
||||
let container;
|
||||
/* First we check if this point is inside this space. */
|
||||
if (this.container.frame.isThisPointHere(point) === true) {
|
||||
return this.container;
|
||||
} else {
|
||||
/* This point does not belong to this space. */
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,14 +189,10 @@
|
||||
|
||||
if (timePeriod >= _1_HOUR_IN_MILISECONDS) {
|
||||
|
||||
let newMarketFile = marketFiles.getFile(pTimePeriod);
|
||||
|
||||
if (newMarketFile !== undefined) {
|
||||
|
||||
marketFile = newMarketFile;
|
||||
recalculate();
|
||||
}
|
||||
marketFile = marketFiles.getFile(pTimePeriod);
|
||||
|
||||
recalculate();
|
||||
|
||||
} else {
|
||||
|
||||
let newFileCursor = dailyFiles.getFileCursor(pTimePeriod);
|
||||
@@ -271,6 +253,8 @@
|
||||
|
||||
try {
|
||||
|
||||
records = []
|
||||
|
||||
if (timePeriod >= _1_HOUR_IN_MILISECONDS) {
|
||||
|
||||
recalculateUsingMarketFiles();
|
||||
@@ -631,10 +615,10 @@
|
||||
|
||||
let imageOffset = {
|
||||
x: 0,
|
||||
y: 15
|
||||
y: 30
|
||||
}
|
||||
let imageSize = (recordPoint2.x - recordPoint1.x) / 2;
|
||||
let recordLabel = record.periods.toString()
|
||||
let recordLabel = record.periods.toLocaleString()
|
||||
if (imageSize < 8) {
|
||||
if (recordLabel[recordLabel.length - 1] !== '0' || imageSize < 4)
|
||||
recordLabel = ''
|
||||
@@ -818,6 +802,8 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user