Bug Fixed

This commit is contained in:
Luis Fernando Molina committed 2020-09-14 15:52:31 +02:00
1 parent 11da081248
commit 960930c6bf
4 files changed
+31 -15

No files matched your search

@@ -6,7 +6,7 @@ function newChartingSpaceFunctions() {
return thisObject
function addAllMineLayers(node, functionLibraryUiObjectsFromNodes) {
function addAllMineLayers(node, rootNodes, functionLibraryUiObjectsFromNodes, functionLibraryNodeDeleter) {
/* Validations to see if we can do this or not. */
if (node.payload === undefined) { return }
@@ -45,6 +45,20 @@ function newChartingSpaceFunctions() {
undefined,
functionLibraryUiObjectsFromNodes
)
/*
There are some layers that should not exist, for example the ones related to Data Products
that do not have a plotter module. Since our previous action created all layers no matter
what, we need now to delete all the ones that do not have a plotter module.
*/
let allLayers = nodeBranchToArray(botLayers, 'Layer')
for (let j = 0; j < allLayers.length; j++) {
let layer = allLayers[j]
let plotterModule = findNodeInNodeMesh(layer, 'Plotter Module', undefined, true, false, false, true)
if (plotterModule === undefined) {
functionLibraryNodeDeleter.deleteUIObject(layer, rootNodes)
}
}
}
}
}
@@ -120,7 +134,7 @@ function newChartingSpaceFunctions() {
for (let k = 0; k < 3; k++) {
let timelineChart = functionLibraryUiObjectsFromNodes.addUIObject(timeMachine, 'Timeline Chart')
timelineChart.layersManager.payload.referenceParent = mineProduct
timelineChart.payload.floatingObject.collapseToggle()
timelineChart.layersManager.payload.floatingObject.collapseToggle()
+1 -1
View File
@@ -742,7 +742,7 @@ function newWorkspace() {
break
case 'Add All Mine Layers':
{
functionLibraryChartingSpaceFunctions.addAllMineLayers(payload.node, functionLibraryUiObjectsFromNodes)
functionLibraryChartingSpaceFunctions.addAllMineLayers(payload.node, thisObject.workspaceNode.rootNodes, functionLibraryUiObjectsFromNodes, functionLibraryNodeDeleter)
}
break
case 'Add Missing Time Machines':
+4 -4
View File
@@ -161,8 +161,8 @@ function newLayer() {
'->Layer->' +
'Data Product->' +
'Data Product Folder->Data Product Folder->Data Product Folder->Data Product Folder->Data Product Folder->' +
'Bot Products->Data Mine Products->' +
'Single Market Data->Exchange Data Products->' +
'Bot Products->Data Mine Products->Trading Mine Products->' +
'Single Market Data->Single Market Trading Data->Exchange Data Products->' +
'Session Reference->Session Independent Data->Session Based Data->Exchange Sessions->Session Based Data->Data Storage->Network Node->' +
'Data Storage->Network Node->' +
'Backtesting Session->Paper Trading Session->Fordward Testing Session->Live Trading Session->' +
@@ -265,9 +265,9 @@ function newLayer() {
return
}
thisObject.plotterModule = findNodeInNodeMesh(thisObject.definition, 'Plotter Module', undefined, false, true, true, true)
thisObject.plotterModule = findNodeInNodeMesh(thisObject.definition, 'Plotter Module', undefined, false, false, false, true)
if (thisObject.plotterModule === undefined) {
thisObject.payload.uiObject.setErrorMessage('Market Quoted Asset not Found')
thisObject.payload.uiObject.setErrorMessage('Plotter Module not Found')
return
}
+10 -8
View File
@@ -4,13 +4,15 @@ function findNodeInNodeMesh(node, nodeType, nodeName, connectedViaPayload, findI
returns the first instance found. Please specify either nodeType
or nodeName.
*/
const MAX_DEPTH = 100
let nodeFound
scanNodeMesh(node)
scanNodeMesh(node, 0)
return nodeFound
function scanNodeMesh(startingNode) {
function scanNodeMesh(startingNode, depth) {
if (startingNode === undefined) { return }
if (nodeFound !== undefined) { return }
if (depth >= MAX_DEPTH) {return}
let nodeDefinition = APP_SCHEMA_MAP.get(startingNode.type)
if (nodeDefinition === undefined) { return }
@@ -37,14 +39,14 @@ function findNodeInNodeMesh(node, nodeType, nodeName, connectedViaPayload, findI
switch (property.type) {
case 'node': {
scanNodeMesh(startingNode[property.name])
scanNodeMesh(startingNode[property.name], depth + 1)
}
break
case 'array': {
let startingNodePropertyArray = startingNode[property.name]
if (startingNodePropertyArray !== undefined) {
for (let m = 0; m < startingNodePropertyArray.length; m++) {
scanNodeMesh(startingNodePropertyArray[m])
scanNodeMesh(startingNodePropertyArray[m], depth + 1)
}
}
break
@@ -58,11 +60,11 @@ function findNodeInNodeMesh(node, nodeType, nodeName, connectedViaPayload, findI
if (findInParents === true) {
if (connectedViaPayload === true) {
if (startingNode.payload.parentNode !== undefined) {
scanNodeMesh(startingNode.payload.parentNode)
scanNodeMesh(startingNode.payload.parentNode, depth + 1)
}
} else {
if (startingNode.parentNode !== undefined) {
scanNodeMesh(startingNode.parentNode)
scanNodeMesh(startingNode.parentNode, depth + 1)
}
}
}
@@ -71,11 +73,11 @@ function findNodeInNodeMesh(node, nodeType, nodeName, connectedViaPayload, findI
if (findInReferenceParents === true) {
if (connectedViaPayload === true) {
if (startingNode.payload.referenceParent !== undefined) {
scanNodeMesh(startingNode.payload.referenceParent)
scanNodeMesh(startingNode.payload.referenceParent, depth + 1)
}
} else {
if (startingNode.referenceParent !== undefined) {
scanNodeMesh(startingNode.referenceParent)
scanNodeMesh(startingNode.referenceParent, depth + 1)
}
}
}