Commit aece7cae authored by project's avatar project

--no commit message

--no commit message
parent 1f032e80
...@@ -21,10 +21,10 @@ function perform_function(context,request,response){ ...@@ -21,10 +21,10 @@ function perform_function(context,request,response){
"longitude": "", "longitude": "",
"data":[] "data":[]
}; };
async.whilst(function() { return idx < di_data.data.length;}, function(callback) { async.whilst(function() { return idx < di_data.data.length;}, function(callback) {
let dtype = di_data.data[idx].data_types; let dtype = di_data.data[idx].data_types;
if(di_data.data[idx].value.length > 0){ if(di_data.data[idx].value.length > 0){
let json = parser.toJson(di_data.data[idx].value[0], {object: true}); let json = parser.toJson(di_data.data[idx].value[0], {object: true});
agriParser.getParser(json.xhr.IO.Type).getValues(di_data.data[idx].value, function(values) { agriParser.getParser(json.xhr.IO.Type).getValues(di_data.data[idx].value, function(values) {
...@@ -39,19 +39,21 @@ function perform_function(context,request,response){ ...@@ -39,19 +39,21 @@ function perform_function(context,request,response){
callback(); callback();
}); });
} }
else callback(); else callback();
}); });
} }
}, function(err) { }, function(err) {
if( err ) { if( err ) {
console.log(err); console.log(err);
} else { } else {
//fs.writeFileSync("./result.json", JSON.stringify(result)); //fs.writeFileSync("./result.json", JSON.stringify(result));
//console.log(JSON.stringify(result)); //console.log(JSON.stringify(result));
response.success(result, output_type); if(result.data.length > 0)
response.success(result, output_type);
else response.reject();
} }
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment