Skip to content

Commit b401fb5

Browse files
Merge remote-tracking branch 'origin' into refactor/ID-restriction-application
2 parents eb76ff7 + 43d21b9 commit b401fb5

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

PrismaFastApi/src/services/decision_tree/decision_tree_creator_v3.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,26 @@ def convert_to_decision_tree_partial(
748748

749749
visited_states: set[tuple[tuple[uuid.UUID, ...], uuid.UUID]] = set()
750750

751+
# auto-expand the paths that are almost at the endnodes
752+
almost_endnode_paths = [path for path in paths if len(path) == len(partial_order) - 1]
753+
for path in almost_endnode_paths:
754+
state_id = path[-1]
755+
issue = self.get_node_from_uuid(partial_order[len(path)])
756+
757+
# get the last states of the tree from the issues
758+
if issue is not None and isinstance(issue, IssueOutgoingDto):
759+
next_states = []
760+
if issue.type == Type.DECISION.value and issue.decision is not None:
761+
next_states = [option.id for option in issue.decision.options]
762+
elif issue.type == Type.UNCERTAINTY.value and issue.uncertainty is not None:
763+
next_states = [outcome.id for outcome in issue.uncertainty.outcomes]
764+
else:
765+
continue
766+
for last_state in next_states:
767+
if last_state != state_id:
768+
new_path = path + [last_state]
769+
paths.append(new_path)
770+
751771
for path in paths:
752772
for k, state_id in enumerate(path):
753773
issue = self.get_node_from_uuid(partial_order[k])

0 commit comments

Comments
 (0)