mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-04 06:31:47 +01:00
🎨 Add kernel API /api/riff/getRiffCardsByBlockIDs Fix https://github.com/siyuan-note/siyuan/issues/10535
This commit is contained in:
parent
d55dcf1bf7
commit
e083dacca8
4 changed files with 54 additions and 4 deletions
|
|
@ -67,8 +67,11 @@ type Block struct {
|
|||
}
|
||||
|
||||
type RiffCard struct {
|
||||
Due time.Time `json:"due"`
|
||||
Reps uint64 `json:"reps"`
|
||||
Due time.Time `json:"due"`
|
||||
Reps uint64 `json:"reps"`
|
||||
Lapses uint64 `json:"lapses"`
|
||||
State fsrs.State `json:"state"`
|
||||
LastReview time.Time `json:"lastReview"`
|
||||
}
|
||||
|
||||
func getRiffCard(card *fsrs.Card) *RiffCard {
|
||||
|
|
@ -78,8 +81,11 @@ func getRiffCard(card *fsrs.Card) *RiffCard {
|
|||
}
|
||||
|
||||
return &RiffCard{
|
||||
Due: due,
|
||||
Reps: card.Reps,
|
||||
Due: due,
|
||||
Reps: card.Reps,
|
||||
Lapses: card.Lapses,
|
||||
State: card.State,
|
||||
LastReview: card.LastReview,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,22 @@ import (
|
|||
"github.com/siyuan-note/siyuan/kernel/util"
|
||||
)
|
||||
|
||||
func GetFlashcardsByBlockIDs(blockIDs []string, page, pageSize int) (blocks []*Block, total, pageCount int) {
|
||||
deckLock.Lock()
|
||||
defer deckLock.Unlock()
|
||||
|
||||
waitForSyncingStorages()
|
||||
|
||||
deck := Decks[builtinDeckID]
|
||||
if nil == deck {
|
||||
return
|
||||
}
|
||||
|
||||
cards := deck.GetCardsByBlockIDs(blockIDs)
|
||||
blocks, total, pageCount = getCardsBlocks(cards, page, pageSize)
|
||||
return
|
||||
}
|
||||
|
||||
type SetFlashcardDueTime struct {
|
||||
ID string `json:"id"` // 卡片 ID
|
||||
Due string `json:"due"` // 下次复习时间,格式为 YYYYMMDDHHmmss
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue