Improve flashcard tree performance

This commit is contained in:
Liang Ding 2023-05-08 20:47:57 +08:00
parent fe9d83df13
commit 094593de25
No known key found for this signature in database
GPG key ID: 136F30F901A2231D

View file

@ -396,12 +396,12 @@ func GetTreeDueFlashcards(rootID string, reviewedCardIDs []string) (ret []*Flash
}
func getTreeSubTreeChildBlocks(rootID string) (treeBlockIDs []string) {
tree, err := loadTreeByBlockID(rootID)
if nil != err {
root := treenode.GetBlockTree(rootID)
if nil == root {
return
}
bts := treenode.GetBlockTreesByPathPrefix(strings.TrimSuffix(tree.Path, ".sy"))
bts := treenode.GetBlockTreesByPathPrefix(strings.TrimSuffix(root.Path, ".sy"))
for _, bt := range bts {
treeBlockIDs = append(treeBlockIDs, bt.ID)
}