From 5890b62ec20a714a077a0b4e5a216a54467dbd96 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 15 Nov 2019 10:23:27 +0100 Subject: [PATCH] Bug fixed writting data range --- MultiPeriod.js | 14 ++++++-------- MultiPeriodDaily.js | 12 +++++------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/MultiPeriod.js b/MultiPeriod.js index a2707c4e3..01269d5a4 100644 --- a/MultiPeriod.js +++ b/MultiPeriod.js @@ -959,21 +959,19 @@ if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> writeDataRanges -> Entering function."); } - let productIndex = 0; - productLoopBody(); + let outputDatasetIndex = -1; + controlLoop(); function productLoopBody() { - - let product = bot.products[productIndex]; - - writeDataRange(contextVariables.dateBeginOfMarket, bot.multiPeriodProcessDatetime, product, currentOutputPeriodName, controlLoop); + let folderName = bot.processNode.referenceParent.processOutput.outputDatasets[outputDatasetIndex].referenceParent.parentNode.code.codeName; + writeDataRange(contextVariables.dateBeginOfMarket, bot.multiPeriodDailyProcessDatetime, folderName, controlLoop); } function controlLoop() { - productIndex++; + outputDatasetIndex++; - if (productIndex < bot.products.length) { + if (outputDatasetIndex < bot.processNode.referenceParent.processOutput.outputDatasets.length) { productLoopBody(); } else { callBack(global.DEFAULT_OK_RESPONSE); diff --git a/MultiPeriodDaily.js b/MultiPeriodDaily.js index 4eed634dd..d10d0c40b 100644 --- a/MultiPeriodDaily.js +++ b/MultiPeriodDaily.js @@ -692,21 +692,19 @@ if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> writeDataRanges -> Entering function."); } - let productIndex = 0; - productLoopBody(); + let outputDatasetIndex = -1; + controlLoop(); function productLoopBody() { - - let folderName = bot.products[productIndex].codeName; - + let folderName = bot.processNode.referenceParent.processOutput.outputDatasets[outputDatasetIndex].referenceParent.parentNode.code.codeName; writeDataRange(contextVariables.dateBeginOfMarket, bot.multiPeriodDailyProcessDatetime, folderName, controlLoop); } function controlLoop() { - productIndex++; + outputDatasetIndex++; - if (productIndex < bot.products.length) { + if (outputDatasetIndex < bot.processNode.referenceParent.processOutput.outputDatasets.length) { productLoopBody(); } else { callBack(global.DEFAULT_OK_RESPONSE);