Fix in group map calculation

Former-commit-id: 1d77a55b629553ac89cb0ae33d1d1f1ad76c3de3
This commit is contained in:
fbsanchez 2019-03-21 21:34:56 +01:00
parent 26d231e78c
commit 6990951dc7

View File

@ -644,6 +644,15 @@ class NetworkMap
'order' => 'ASC', 'order' => 'ASC',
] ]
); );
// Remap ids.
$nodes = array_reduce(
$nodes,
function ($carry, $item) {
$carry[$item['id_agente']] = $item;
return $carry;
}
);
} }
return $nodes; return $nodes;
@ -741,7 +750,7 @@ class NetworkMap
$parent_node = $this->nodes[$parent_id]['id_node']; $parent_node = $this->nodes[$parent_id]['id_node'];
// Store relationship. // Store relationship.
if ($parent_node) { if ($parent_node && $node['id_parent'] > 0) {
$rel = []; $rel = [];
// Node reference (parent). // Node reference (parent).
@ -1202,7 +1211,9 @@ class NetworkMap
} }
if ($valid === 1) { if ($valid === 1) {
$cleaned[] = $rel; if ($rel['id_parent'] != $rel['id_child']) {
$cleaned[] = $rel;
}
} }
} }
@ -2263,6 +2274,9 @@ class NetworkMap
} }
} }
// Prioritize relations between same nodes.
$this->cleanGraphRelations();
// Save data. // Save data.
if ($this->idMap > 0 && (isset($this->map['__simulated']) === false)) { if ($this->idMap > 0 && (isset($this->map['__simulated']) === false)) {
if (enterprise_installed()) { if (enterprise_installed()) {