more study chapter depth limiting

pull/8091/head
Thibault Duplessis 2021-02-03 06:50:22 +01:00
parent 53d11dbb82
commit afb951dc7b
1 changed files with 7 additions and 6 deletions

View File

@ -56,11 +56,12 @@ private object StudyFlatTree {
root.children.nodes.flatMap { traverse(_, Path.root) }
}
private def traverse(node: Node, parentPath: Path): Vector[(String, Bdoc)] = {
val path = parentPath + node.id
node.children.nodes.flatMap {
traverse(_, path)
} appended (Path.encodeDbKey(path) -> writeNode(node))
}
private def traverse(node: Node, parentPath: Path): Vector[(String, Bdoc)] =
(parentPath.depth < Node.MAX_PLIES) ?? {
val path = parentPath + node.id
node.children.nodes.flatMap {
traverse(_, path)
} appended (Path.encodeDbKey(path) -> writeNode(node))
}
}
}