Skip to content

Commit

Permalink
Fix browse routes
Browse files Browse the repository at this point in the history
  • Loading branch information
bkis committed Aug 21, 2023
1 parent 82fe9dd commit 8cf249c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Tekst-API/tekst/routers/browse.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,14 @@ async def get_path_options_by_head_id(
# construct options for this path up to root node
options = []
while node_doc and node_doc.parent_id:
siblings = await NodeDocument.find({"parentId": node_doc.parent_id}).to_list()
siblings = await NodeDocument.find(NodeDocument.parent_id == node_doc.parent_id).to_list()
options.insert(0, siblings)
node_doc = await NodeDocument.get(node_doc.parent_id)
# lastly, insert options for root level
if node_doc:
root_lvl_options = await NodeDocument.find(
{"textId": node_doc.text_id, "level": 0}
NodeDocument.text_id == node_doc.text_id,
NodeDocument.level == 0,
).to_list()
options.insert(0, root_lvl_options)
return options
Expand All @@ -160,7 +161,7 @@ async def get_path_options_by_root_id(
# construct options for this path up to max_level
options = []
while node_doc:
children = await NodeDocument.find({"parentId": node_doc.id}).to_list()
children = await NodeDocument.find(NodeDocument.parent_id == node_doc.id).to_list()
if len(children) == 0:
break
options.append(children)
Expand Down Expand Up @@ -193,7 +194,7 @@ async def get_layer_coverage_data(
"$lookup": {
"from": "units",
"localField": "_id",
"foreignField": "nodeId",
"foreignField": "node_id",
"as": "units",
}
},
Expand Down

0 comments on commit 8cf249c

Please sign in to comment.