From d86a4862ca1c0e86880401d9ebe19022c2437400 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sun, 9 Aug 2020 21:13:47 +0200 Subject: [PATCH] Bug Fixed --- Plotting/Plotter.js | 10 ++++++++++ Plotting/RecordValues.js | 19 ++++++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/Plotting/Plotter.js b/Plotting/Plotter.js index ff0533e40..128025d10 100644 --- a/Plotting/Plotter.js +++ b/Plotting/Plotter.js @@ -282,6 +282,16 @@ function newPlotter() { } } + if (productDefinition.config.nodePathType === 'array') { + /* + When we have an array configuration, we know that the last field of the record + contains the array index, which is needed to correctly plot this data. Since + this index is not part of the product definition, we will restore its value in + this way: + */ + record.index = dataFile[i][recordDefinition.properties.length] + } + if ( (record.begin >= farLeftDate.valueOf() && record.end <= farRightDate.valueOf()) && (record.end >= coordinateSystem.min.x && record.begin <= coordinateSystem.max.x) diff --git a/Plotting/RecordValues.js b/Plotting/RecordValues.js index 20917353d..931e988a8 100644 --- a/Plotting/RecordValues.js +++ b/Plotting/RecordValues.js @@ -59,11 +59,15 @@ function newRecordValues() { function scanProperties(productRootNode, index) { for (let i = 0; i < productDefinition.record.properties.length; i++) { let property = productDefinition.record.properties[i] + let key = property.id + if (index !== undefined) { + key = property.id + '-' + index + } if (property.config.nodePath !== undefined) { let propertyRoot = eval(property.config.nodePath) - propertyTargetNodeMap.set(property.id, propertyRoot) + propertyTargetNodeMap.set(key, propertyRoot) } else { - propertyTargetNodeMap.set(property.id, productRootNode) + propertyTargetNodeMap.set(key, productRootNode) } } } @@ -74,7 +78,16 @@ function newRecordValues() { for (let i = 0; i < productDefinition.record.properties.length; i++) { let property = productDefinition.record.properties[i] let value = currentRecord[property.config.codeName] - let targetNode = propertyTargetNodeMap.get(property.id) + let key = property.id + if (productDefinition.config.nodePathType === 'array') { + /* + When we have an array configuration, in this case we will use the index + property that was injected into the record in order to build the key to + get the node where we have to send the value. + */ + key = property.id + '-' + currentRecord.index + } + let targetNode = propertyTargetNodeMap.get(key) /* If the codeName of the Record Property can not match the name of the property at the target node, the user can explicitly specify the property name at the configuration,