lib/society/formatter/report/templates/components/society-assets/society.js in society-1.2.2 vs lib/society/formatter/report/templates/components/society-assets/society.js in society-1.2.3
- old
+ new
@@ -245,17 +245,20 @@
}
return clusterId;
};
var findCluster = data.clusters ? _findCluster : function() { return 0; };
+ var dataKeys = Object.keys(data);
return {
- nodes: Object.keys(data).map(function(node, index) {
+ nodes: dataKeys.map(function(node, index) {
return { name: node, group: findCluster(index) };
}),
- links: Object.keys(data).reduce(function(edges, node, source) {
- var new_edges = Object.keys(data[node]).map(function(edge, target) {
- return { source: source, target: target, value: data[node][edge] };
+ links: dataKeys.reduce(function(edges, node, source) {
+ var new_edges = Object.keys(data[node]).filter(function(edge) {
+ return(Object.keys(data).indexOf(edge) != -1);
+ }).map(function(edge) {
+ return { source: source, target: dataKeys.indexOf(edge), value: data[node][edge] };
});
return(edges.concat(new_edges));
}, [])
};
};