mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-21 19:41:05 +08:00
⚡ Improve spaced repetition loading performance https://github.com/siyuan-note/siyuan/issues/11927
This commit is contained in:
parent
a683464b75
commit
3d36355e2b
@ -1078,18 +1078,24 @@ func getDeckDueCards(deck *riff.Deck, reviewedCardIDs, blockIDs []string, newCar
|
|||||||
var retNew, retOld []riff.Card
|
var retNew, retOld []riff.Card
|
||||||
|
|
||||||
dues := deck.Dues()
|
dues := deck.Dues()
|
||||||
|
toChecks := map[string]riff.Card{}
|
||||||
var tmp []riff.Card
|
|
||||||
for _, c := range dues {
|
for _, c := range dues {
|
||||||
if 0 < len(blockIDs) && !gulu.Str.Contains(c.BlockID(), blockIDs) {
|
if 0 < len(blockIDs) && !gulu.Str.Contains(c.BlockID(), blockIDs) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if !treenode.ExistBlockTree(c.BlockID()) {
|
toChecks[c.BlockID()] = c
|
||||||
continue
|
}
|
||||||
|
var toCheckBlockIDs []string
|
||||||
|
var tmp []riff.Card
|
||||||
|
for bID, _ := range toChecks {
|
||||||
|
toCheckBlockIDs = append(toCheckBlockIDs, bID)
|
||||||
|
}
|
||||||
|
checkResult := treenode.ExistBlockTrees(toCheckBlockIDs)
|
||||||
|
for bID, exists := range checkResult {
|
||||||
|
if exists {
|
||||||
|
tmp = append(tmp, toChecks[bID])
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp = append(tmp, c)
|
|
||||||
}
|
}
|
||||||
dues = tmp
|
dues = tmp
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user