mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-03 19:41:31 +08:00
🐛 闪卡管理分页失效 Fix https://github.com/siyuan-note/siyuan/issues/7638
This commit is contained in:
parent
0f62506d25
commit
f0cce9f6d1
@ -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) {
|
func getCardsBlocks(cards []riff.Card, page int) (blocks []*Block, total, pageCount int) {
|
||||||
const pageSize = 20
|
const pageSize = 20
|
||||||
|
total = len(cards)
|
||||||
|
pageCount = int(math.Ceil(float64(total) / float64(pageSize)))
|
||||||
start := (page - 1) * pageSize
|
start := (page - 1) * pageSize
|
||||||
end := page * pageSize
|
end := page * pageSize
|
||||||
if start > len(cards) {
|
if start > len(cards) {
|
||||||
@ -144,10 +146,9 @@ func getCardsBlocks(cards []riff.Card, page int) (blocks []*Block, total, pageCo
|
|||||||
if end > len(cards) {
|
if end > len(cards) {
|
||||||
end = len(cards)
|
end = len(cards)
|
||||||
}
|
}
|
||||||
cardIDs := cards[start:end]
|
|
||||||
total = len(cards)
|
cards = cards[start:end]
|
||||||
pageCount = int(math.Ceil(float64(total) / float64(pageSize)))
|
if 1 > len(cards) {
|
||||||
if 1 > len(cardIDs) {
|
|
||||||
blocks = []*Block{}
|
blocks = []*Block{}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user