[Feature] Scenario and Additional Information creation via enviPath-python, Add Half Lifes to API Output, Fix source/target ids in legacy API (#340)

Co-authored-by: Tim Lorsbach <tim@lorsba.ch>
Reviewed-on: enviPath/enviPy#340
This commit is contained in:
2026-03-06 07:20:18 +13:00
parent 81cc612e69
commit 6e00926371
3 changed files with 795 additions and 32 deletions

View File

@ -1842,7 +1842,7 @@ class Pathway(EnviPathModel, AliasMixin, ScenarioMixin):
queue.append(n)
# Add unconnected nodes
for n in self.nodes:
for n in self.nodes.order_by("url"):
if len(n.out_edges.all()) == 0:
if n not in queue:
queue.append(n)
@ -1852,8 +1852,8 @@ class Pathway(EnviPathModel, AliasMixin, ScenarioMixin):
processed.add(current)
nodes.append(current.d3_json())
for e in self.edges.filter(start_nodes=current).distinct():
for prod in e.end_nodes.all():
for e in self.edges.filter(start_nodes=current).order_by("url").distinct():
for prod in e.end_nodes.all().order_by("url"):
if prod not in queue and prod not in processed:
queue.append(prod)