From 427de224adbb5dcafa42f1dcfe215195a70b8e03 Mon Sep 17 00:00:00 2001 From: wimrijnders Date: Tue, 20 Jun 2017 19:23:33 +0200 Subject: [PATCH] Reverse nodes returned with 'from' and 'to' directions (#3186) The returned node id's were exactly the wrong way around; 'to' returned the parents, 'from' returned the children. This fix swaps the tests for determining which to return. --- lib/network/modules/NodesHandler.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/network/modules/NodesHandler.js b/lib/network/modules/NodesHandler.js index e7e918d5..85a00c9c 100644 --- a/lib/network/modules/NodesHandler.js +++ b/lib/network/modules/NodesHandler.js @@ -425,13 +425,13 @@ class NodesHandler { let nodeObj = {}; // used to quickly check if node already exists for (let i = 0; i < node.edges.length; i++) { let edge = node.edges[i]; - if (direction !== 'from' && edge.toId == node.id) { // these are double equals since ids can be numeric or string + if (direction !== 'to' && edge.toId == node.id) { // these are double equals since ids can be numeric or string if (nodeObj[edge.fromId] === undefined) { nodeList.push(edge.fromId); nodeObj[edge.fromId] = true; } } - else if (direction !== 'to' && edge.fromId == node.id) { // these are double equals since ids can be numeric or string + else if (direction !== 'from' && edge.fromId == node.id) { // these are double equals since ids can be numeric or string if (nodeObj[edge.toId] === undefined) { nodeList.push(edge.toId); nodeObj[edge.toId] = true;