Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: 闪卡复习时支持跳过 https://github.com/siyuan-note/siyuan/issues/7697

Liang Dingd28c7d212a6e
diff --git a/kernel/model/flashcard.go b/kernel/model/flashcard.go
index c040bfc422..622ad8d177 100644
--- a/kernel/model/flashcard.go
+++ b/kernel/model/flashcard.go
@@ -29,6 +29,7 @@ import (
"github.com/88250/gulu"
"github.com/88250/lute/ast"
"github.com/88250/lute/parse"
+ "github.com/open-spaced-repetition/go-fsrs"
"github.com/siyuan-note/logging"
"github.com/siyuan-note/riff"
"github.com/siyuan-note/siyuan/kernel/cache"
@@ -634,6 +635,10 @@ func removeFlashcardsByBlockIDs(blockIDs []string, deck *riff.Deck) {
}
cards := deck.GetCardsByBlockIDs(blockIDs)
+ if 1 > len(cards) {
+ return
+ }
+
for _, card := range cards {
deck.RemoveCard(card.ID())
}
@@ -900,11 +905,20 @@ func getDeckDueCards(deck *riff.Deck) (ret []riff.Card) {
ret = []riff.Card{}
dues := deck.Dues()
+ newCount := 0
+ reviewCount := 0
for _, c := range dues {
if nil != skipCardCache[c.ID()] {
continue
}
+ fsrsCard := c.Impl().(*fsrs.Card)
+ if fsrs.New == fsrsCard.State {
+ newCount++
+ } else {
+ reviewCount++
+ }
+
ret = append(ret, c)
}
return