Merge branch '1321-falta-de-datos-al-exportar-CSV-desde-graficas-dev' into 'develop'

fixed csv import

See merge request !890
This commit is contained in:
vgilc 2017-10-05 17:01:09 +02:00
commit eac3462f60
1 changed files with 10 additions and 4 deletions

View File

@ -22,7 +22,7 @@
result = [];
// Throw errors
var retrieveDataOject = function (dataObjects) {
var retrieveDataOject = function (dataObjects, custom) {
var result;
if (typeof dataObjects === 'undefined')
@ -34,7 +34,13 @@
}
if (dataObjects.length > 1) {
dataObjects.forEach(function (element) {
result = element;
if(custom){
if (/^Avg.:/i.test(element.label)){
result = element;
}
} else {
result = element;
}
});
// If the avg set is missing, retrieve the first set
@ -142,14 +148,14 @@
var custom_graph = $('#hidden-custom_graph').val();
if (custom_graph) {
dataObject = retrieveDataOject(dataObjects);
dataObject = retrieveDataOject(dataObjects,0);
dataObjects.forEach(function (element) {
elements.push(processDataObject(element));
});
graphData = elements;
}
else {
dataObject = retrieveDataOject(dataObjects);
dataObject = retrieveDataOject(dataObjects,1);
elements.push(processDataObject(dataObject));
graphData = elements;
}