mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-01 06:18:49 +01:00
🎨 Try fill flashcard to db tpl https://github.com/siyuan-note/siyuan/issues/10502#issuecomment-1986703280
This commit is contained in:
parent
42651a23a9
commit
16fd52a74d
2 changed files with 48 additions and 10 deletions
|
|
@ -513,7 +513,7 @@ type Flashcard struct {
|
|||
NextDues map[riff.Rating]string `json:"nextDues"`
|
||||
}
|
||||
|
||||
func newFlashcard(card riff.Card, blockID, deckID string, now time.Time) *Flashcard {
|
||||
func newFlashcard(card riff.Card, deckID string, now time.Time) *Flashcard {
|
||||
nextDues := map[riff.Rating]string{}
|
||||
for rating, due := range card.NextDues() {
|
||||
nextDues[rating] = strings.TrimSpace(util.HumanizeDiffTime(due, now, Conf.Lang))
|
||||
|
|
@ -522,7 +522,7 @@ func newFlashcard(card riff.Card, blockID, deckID string, now time.Time) *Flashc
|
|||
return &Flashcard{
|
||||
DeckID: deckID,
|
||||
CardID: card.ID(),
|
||||
BlockID: blockID,
|
||||
BlockID: card.BlockID(),
|
||||
Lapses: card.GetLapses(),
|
||||
Reps: card.GetReps(),
|
||||
State: card.GetState(),
|
||||
|
|
@ -572,7 +572,7 @@ func GetNotebookDueFlashcards(boxID string, reviewedCardIDs []string) (ret []*Fl
|
|||
cards, unreviewedCnt, unreviewedNewCardCnt, unreviewedOldCardCnt := getDeckDueCards(deck, reviewedCardIDs, treeBlockIDs, Conf.Flashcard.NewCardLimit, Conf.Flashcard.ReviewCardLimit, Conf.Flashcard.ReviewMode)
|
||||
now := time.Now()
|
||||
for _, card := range cards {
|
||||
ret = append(ret, newFlashcard(card, card.BlockID(), builtinDeckID, now))
|
||||
ret = append(ret, newFlashcard(card, builtinDeckID, now))
|
||||
}
|
||||
if 1 > len(ret) {
|
||||
ret = []*Flashcard{}
|
||||
|
|
@ -617,7 +617,7 @@ func GetTreeDueFlashcards(rootID string, reviewedCardIDs []string) (ret []*Flash
|
|||
cards, unreviewedCnt, unreviewedNewCardCnt, unreviewedOldCardCnt := getDeckDueCards(deck, reviewedCardIDs, treeBlockIDs, newCardLimit, reviewCardLimit, Conf.Flashcard.ReviewMode)
|
||||
now := time.Now()
|
||||
for _, card := range cards {
|
||||
ret = append(ret, newFlashcard(card, card.BlockID(), builtinDeckID, now))
|
||||
ret = append(ret, newFlashcard(card, builtinDeckID, now))
|
||||
}
|
||||
if 1 > len(ret) {
|
||||
ret = []*Flashcard{}
|
||||
|
|
@ -688,7 +688,7 @@ func getDueFlashcards(deckID string, reviewedCardIDs []string) (ret []*Flashcard
|
|||
cards, unreviewedCnt, unreviewedNewCardCnt, unreviewedOldCardCnt := getDeckDueCards(deck, reviewedCardIDs, nil, Conf.Flashcard.NewCardLimit, Conf.Flashcard.ReviewCardLimit, Conf.Flashcard.ReviewMode)
|
||||
now := time.Now()
|
||||
for _, card := range cards {
|
||||
ret = append(ret, newFlashcard(card, card.BlockID(), deckID, now))
|
||||
ret = append(ret, newFlashcard(card, deckID, now))
|
||||
}
|
||||
if 1 > len(ret) {
|
||||
ret = []*Flashcard{}
|
||||
|
|
@ -707,7 +707,7 @@ func getAllDueFlashcards(reviewedCardIDs []string) (ret []*Flashcard, unreviewed
|
|||
unreviewedNewCardCount += unreviewedNewCardCnt
|
||||
unreviewedOldCardCount += unreviewedOldCardCnt
|
||||
for _, card := range cards {
|
||||
ret = append(ret, newFlashcard(card, card.BlockID(), deck.ID, now))
|
||||
ret = append(ret, newFlashcard(card, deck.ID, now))
|
||||
}
|
||||
}
|
||||
if 1 > len(ret) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue