fix [generator] bug displaying relations to priv clusters multiple times

in table
pull/932/head
niclas 2024-02-16 12:15:14 +01:00
parent 401cee30c4
commit 946b337796
1 changed files with 34 additions and 18 deletions

View File

@ -144,7 +144,6 @@ class Cluster:
self.meta = meta
self.entry = ""
self.galaxie = galaxie
self.related_clusters = []
global public_clusters_dict
if self.galaxie:
@ -207,7 +206,9 @@ class Cluster:
if meta not in excluded_meta:
self.entry += f" | {meta} | {self.meta[meta]} |\n"
def get_related_clusters(self, cluster_dict, depth=-1, visited=None, level=1):
def get_related_clusters(
self, cluster_dict, depth=-1, visited=None, level=1, related_private_clusters={}
):
global public_relations_count
global private_relations_count
global private_clusters
@ -238,6 +239,15 @@ class Cluster:
private_relations_count += 1
if dest_uuid not in private_clusters:
private_clusters.append(dest_uuid)
if dest_uuid in related_private_clusters:
related_clusters.append(
(
self,
related_private_clusters[dest_uuid],
level,
)
)
else:
related_clusters.append(
(
self,
@ -253,6 +263,7 @@ class Cluster:
level,
)
)
related_private_clusters[dest_uuid] = related_clusters[-1][1]
continue
related_cluster = cluster_dict[dest_uuid]
@ -269,7 +280,13 @@ class Cluster:
if cluster["dest-uuid"] in cluster_dict:
related_clusters += cluster_dict[
cluster["dest-uuid"]
].get_related_clusters(cluster_dict, new_depth, visited, level + 1)
].get_related_clusters(
cluster_dict,
new_depth,
visited,
level + 1,
related_private_clusters,
)
if empty_uuids > 0:
empty_uuids_dict[self.value] = empty_uuids
@ -301,7 +318,6 @@ class Cluster:
cluster for cluster in related_clusters if cluster not in to_remove
]
self.related_clusters = related_clusters
return related_clusters
def _create_related_entry(self):