mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-01 14:28:49 +01:00
🎨 支持浏览卡包内的闪卡 https://github.com/siyuan-note/siyuan/issues/6943
This commit is contained in:
parent
b999d293d5
commit
192679eedd
1 changed files with 4 additions and 0 deletions
|
|
@ -41,6 +41,7 @@ var Decks = map[string]*riff.Deck{}
|
|||
var deckLock = sync.Mutex{}
|
||||
|
||||
func GetFlashcards(deckID string, page int) (blockIDs []string, total, pageCount int) {
|
||||
blockIDs = []string{}
|
||||
deck := Decks[deckID]
|
||||
if nil == deck {
|
||||
return
|
||||
|
|
@ -64,6 +65,9 @@ func GetFlashcards(deckID string, page int) (blockIDs []string, total, pageCount
|
|||
blockIDs = allBlockIDs[start:end]
|
||||
total = len(allBlockIDs)
|
||||
pageCount = int(math.Ceil(float64(total) / float64(pageSize)))
|
||||
if 1 > len(blockIDs) {
|
||||
blockIDs = []string{}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue