Skip to content

Commit a4ba997

Browse files
Re-add old comments
1 parent f875bca commit a4ba997

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pydatalab/src/pydatalab/routes/v0_1/graphs.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,14 @@ def get_graph_cy_format(
104104
nodes = []
105105
edges = []
106106

107+
# Collect the elements that have already been added to the graph, to avoid duplication
107108
drawn_elements = set()
108109
node_collections: set[str] = set()
109-
110110
for document in all_documents:
111+
# for some reason, document["relationships"] is sometimes equal to None, so we
112+
# need this `or` statement.
111113
for relationship in document.get("relationships") or []:
114+
# only considering child-parent relationships
112115
if relationship.get("type") == "collections" and not collection_id:
113116
if hide_collections:
114117
continue
@@ -152,6 +155,7 @@ def get_graph_cy_format(
152155
continue
153156

154157
for relationship in document.get("relationships") or []:
158+
# only considering child-parent relationships:
155159
if relationship.get("relation") not in ("parent", "is_part_of"):
156160
continue
157161

0 commit comments

Comments
 (0)