Session Reference

This commit is contained in:
Luis Fernando Molina committed 2020-09-13 20:04:23 +02:00
1 parent c7bc3ea93b
commit dde838e145
2 files changed
+29 -4

No files matched your search

@@ -2,6 +2,7 @@ function newDataStorageFunctions() {
thisObject = {
addAllDataProducts: addAllDataProducts,
addAllDataMineProducts: addAllDataMineProducts,
addAllTradingMineProducts: addAllTradingMineProducts,
addMissingSessionReferences: addMissingSessionReferences
}
@@ -27,12 +28,14 @@ function newDataStorageFunctions() {
we will create a Data Product. In case we find Product Definition Folders, we will recreate that structure
too, using in this case Data Product Folders.
*/
let dataMine = node.payload.referenceParent
scanBotArray(dataMine.sensorBots)
scanBotArray(dataMine.indicatorBots)
scanBotArray(dataMine.tradingBots)
let mine = node.payload.referenceParent
scanBotArray(mine.sensorBots)
scanBotArray(mine.indicatorBots)
scanBotArray(mine.tradingBots)
function scanBotArray(botArray) {
if (botArray === undefined) {return}
for (let i = 0; i < botArray.length; i++) {
let bot = botArray[i]
let botProducts = functionLibraryUiObjectsFromNodes.addUIObject(node, 'Bot Products')
@@ -64,6 +67,17 @@ function newDataStorageFunctions() {
}
}
function addAllTradingMineProducts(node, rootNodes, functionLibraryUiObjectsFromNodes) {
for (let i = 0; i < rootNodes.length; i++) {
let rootNode = rootNodes[i]
if (rootNode.type === 'Trading Mine') {
let tradingMineProducts = functionLibraryUiObjectsFromNodes.addUIObject(node, 'Trading Mine Products')
tradingMineProducts.payload.referenceParent = rootNode
}
}
}
function addMissingSessionReferences(node, rootNodes, functionLibraryUiObjectsFromNodes) {
let networkNode = findNodeInNodeMesh(node, 'Network Node', true, false, true, false)
if (networkNode === undefined) {return}
@@ -84,6 +98,12 @@ function newDataStorageFunctions() {
if (isMissingChildren(node, session, true) === true) {
let sessionReference = functionLibraryUiObjectsFromNodes.addUIObject(node, 'Session Reference')
sessionReference.payload.referenceParent = session
/*
Now I will connect the Session Reference child that is auto created with the market
where the Session was found.
*/
let marketTradingTasks = findNodeInNodeMesh(session, 'Market Trading Tasks', true, false, true, false)
sessionReference.singleMarketTradingData.payload.referenceParent = marketTradingTasks.payload.referenceParent
}
}
}