Fixes #17400: Handle cablepaths directly via multiple single-position rear ports

This commit is contained in:
Erik Hetland
2024-10-09 19:46:31 +02:00
committed by Jeremy Stretch
parent 55fad2f533
commit 111a1ad888
2 changed files with 51 additions and 0 deletions

View File

@@ -666,6 +666,14 @@ class CablePath(models.Model):
rear_port_id=remote_terminations[0].pk,
rear_port_position__in=position_stack.pop()
)
# If all rear ports have a single position, we can just get the front ports
elif all([rp.positions == 1 for rp in remote_terminations]):
front_ports = FrontPort.objects.filter(rear_port_id__in=[rp.pk for rp in remote_terminations])
if len(front_ports) != len(remote_terminations):
# Some rear ports does not have a front port
is_split = True
break
else:
# No position indicated: path has split, so we stop at the RearPorts
is_split = True