forked from enviPath/enviPy
Initial Zoom, fix AD Creation
This commit is contained in:
@ -2205,7 +2205,23 @@ class Pathway(EnviPathModel, AliasMixin, ScenarioMixin, AdditionalInformationMix
|
||||
depth_map[0] = list()
|
||||
processed = set()
|
||||
|
||||
for n in self.root_nodes:
|
||||
data_driven_root_nodes = self.node_set.all().annotate(
|
||||
prod_cnt=Count('edge_products'),
|
||||
educt_cnt=Count('edge_educts')
|
||||
).filter(prod_cnt=0, educt_cnt__gt=0).distinct()
|
||||
|
||||
# Eval QuerySet
|
||||
root_nodes_by_depth = list(self.root_nodes)
|
||||
|
||||
data_driven_root_nodes.update(depth=0)
|
||||
root_nodes = [n for n in data_driven_root_nodes]
|
||||
|
||||
for n in root_nodes_by_depth:
|
||||
if n not in root_nodes:
|
||||
if len(n.edge_products.all()) == 0:
|
||||
root_nodes.append(n)
|
||||
|
||||
for n in root_nodes:
|
||||
depth_map[0].append(n)
|
||||
|
||||
# At most depth len(nodes) is possible
|
||||
|
||||
Reference in New Issue
Block a user