Pārlūkot izejas kodu

:zap: Improve flashcard tree performance

Liang Ding 2 gadi atpakaļ
vecāks
revīzija
094593de25
1 mainītis faili ar 3 papildinājumiem un 3 dzēšanām
  1. 3 3
      kernel/model/flashcard.go

+ 3 - 3
kernel/model/flashcard.go

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