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
1 changed files with 16 additions and 2 deletions

View File

@ -644,6 +644,15 @@ class NetworkMap
'order' => 'ASC',
]
);
// Remap ids.
$nodes = array_reduce(
$nodes,
function ($carry, $item) {
$carry[$item['id_agente']] = $item;
return $carry;
}
);
}
return $nodes;
@ -741,7 +750,7 @@ class NetworkMap
$parent_node = $this->nodes[$parent_id]['id_node'];
// Store relationship.
if ($parent_node) {
if ($parent_node && $node['id_parent'] > 0) {
$rel = [];
// Node reference (parent).
@ -1202,7 +1211,9 @@ class NetworkMap
}
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.
if ($this->idMap > 0 && (isset($this->map['__simulated']) === false)) {
if (enterprise_installed()) {