Skip to content

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

:bug: 闪卡管理分页失效 Fix https://github.com/siyuan-note/siyuan/issues/7638

Liang Dingf0cce9f6d19f
diff --git a/kernel/model/flashcard.go b/kernel/model/flashcard.go
index 7ee0d8dd76..0a557c165f 100644
--- a/kernel/model/flashcard.go
+++ b/kernel/model/flashcard.go
@@ -136,6 +136,8 @@ func GetFlashcards(deckID string, page int) (blocks []*Block, total, pageCount i
func getCardsBlocks(cards []riff.Card, page int) (blocks []*Block, total, pageCount int) {
const pageSize = 20
+ total = len(cards)
+ pageCount = int(math.Ceil(float64(total) / float64(pageSize)))
start := (page - 1) * pageSize
end := page * pageSize
if start > len(cards) {
@@ -144,10 +146,9 @@ func getCardsBlocks(cards []riff.Card, page int) (blocks []*Block, total, pageCo
if end > len(cards) {
end = len(cards)
}
- cardIDs := cards[start:end]
- total = len(cards)
- pageCount = int(math.Ceil(float64(total) / float64(pageSize)))
- if 1 > len(cardIDs) {
+
+ cards = cards[start:end]
+ if 1 > len(cards) {
blocks = []*Block{}
return
}