Return full list of nodes in response metadata

This commit is contained in:
Raul Ochoa 2016-07-05 11:26:52 +02:00
parent 163fa58b5a
commit 6c98f14c64
5 changed files with 12 additions and 6 deletions

View File

@ -4,6 +4,9 @@
Released 2016-mm-dd
Bug fixes:
- Return full list of nodes in response metadata.
## 2.57.0

View File

@ -330,7 +330,7 @@ function getLastUpdatedTime(analysesResults, lastUpdateTime) {
return lastUpdateTime;
}
return analysesResults.reduce(function(lastUpdateTime, analysis) {
return analysis.getSortedNodes().reduce(function(lastNodeUpdatedAtTime, node) {
return analysis.getNodes().reduce(function(lastNodeUpdatedAtTime, node) {
var nodeUpdatedAtDate = node.getUpdatedAt();
var nodeUpdatedTimeAt = (nodeUpdatedAtDate && nodeUpdatedAtDate.getTime()) || 0;
return nodeUpdatedTimeAt > lastNodeUpdatedAtTime ? nodeUpdatedTimeAt : lastNodeUpdatedAtTime;
@ -344,7 +344,7 @@ function addAnalysesMetadata(username, layergroup, analysesResults, includeQuery
layergroup.metadata.analyses = [];
analysesResults.forEach(function(analysis) {
var nodes = analysis.getSortedNodes();
var nodes = analysis.getNodes();
layergroup.metadata.analyses.push({
nodes: nodes.reduce(function(nodesIdMap, node) {
if (node.params.id) {

View File

@ -202,7 +202,7 @@ describe('analysis-layers', function() {
assert.equal(analyses.length, 1, 'Invalid number of analyses in metadata');
var nodes = analyses[0].nodes;
var nodesIds = Object.keys(nodes);
assert.deepEqual(nodesIds, ['2570e105-7b37-40d2-bdf4-1af889598745', 'HEAD']);
assert.deepEqual(nodesIds, ['HEAD', '2570e105-7b37-40d2-bdf4-1af889598745']);
nodesIds.forEach(function(nodeId) {
var node = nodes[nodeId];
assert.ok(node.hasOwnProperty('url'), 'Missing "url" attribute in node');

View File

@ -141,7 +141,7 @@ describe('named-maps analysis', function() {
assert.equal(analyses.length, 1, 'Invalid number of analyses in metadata');
var nodes = analyses[0].nodes;
var nodesIds = Object.keys(nodes);
assert.deepEqual(nodesIds, ['2570e105-7b37-40d2-bdf4-1af889598745', 'HEAD']);
assert.deepEqual(nodesIds, ['HEAD', '2570e105-7b37-40d2-bdf4-1af889598745']);
nodesIds.forEach(function(nodeId) {
var node = nodes[nodeId];
assert.ok(node.hasOwnProperty('url'), 'Missing "url" attribute in node');

View File

@ -100,10 +100,13 @@ describe('analysis-layers regressions', function() {
assert.equal(analyses.length, 1);
var expectedIds = ['customer_home_locations', 'b0', 'b1', 'a2', 'a3', 'a4'];
assert.equal(Object.keys(analyses[0].nodes).length, expectedIds.length, Object.keys(analyses[0].nodes));
expectedIds.forEach(function(expectedId) {
analyses[0].nodes.hasOwnProperty(expectedId);
assert.ok(
analyses[0].nodes.hasOwnProperty(expectedId),
'Missing "' + expectedId + '" from node list.'
);
});
assert.equal(Object.keys(analyses[0].nodes).length, expectedIds.length, Object.keys(analyses[0].nodes));
testClient.drain(done);
});