Skip to content

Commit

Permalink
Guard against missing creators/collections in aggregation
Browse files Browse the repository at this point in the history
  • Loading branch information
ml-evs committed Jul 26, 2023
1 parent 012d150 commit 84132d1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pydatalab/pydatalab/routes/v0_1/graphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def get_graph_cy_format(item_id: Optional[str] = None, collection_id: Optional[s
)

node_ids = {document["item_id"] for document in all_documents} | {
relationship["item_id"]
relationship.get("item_id")
for document in all_documents
for relationship in document.get("relationships", [])
}
Expand Down
4 changes: 2 additions & 2 deletions pydatalab/pydatalab/routes/v0_1/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def creators_lookup() -> Dict:
{
"$match": {
"$expr": {
"$in": ["$_id", "$$creator_ids"],
"$in": ["$_id", {"$ifNull": ["$$creator_ids", []]}],
},
}
},
Expand Down Expand Up @@ -211,7 +211,7 @@ def collections_lookup() -> Dict:
{
"$match": {
"$expr": {
"$in": ["$_id", "$$collection_ids"],
"$in": ["$_id", {"$ifNull": ["$$collection_ids", []]}],
},
"type": "collections",
}
Expand Down

0 comments on commit 84132d1

Please sign in to comment.