mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
🎨 Distinguish between new cards and review cards during spaced repetition https://github.com/siyuan-note/siyuan/issues/9377
This commit is contained in:
parent
afbdb48ddf
commit
ec46cebe77
4 changed files with 14 additions and 10 deletions
|
|
@ -434,6 +434,7 @@ type Flashcard struct {
|
|||
DeckID string `json:"deckID"`
|
||||
CardID string `json:"cardID"`
|
||||
BlockID string `json:"blockID"`
|
||||
State riff.State `json:"state"`
|
||||
NextDues map[riff.Rating]string `json:"nextDues"`
|
||||
}
|
||||
|
||||
|
|
@ -447,6 +448,7 @@ func newFlashcard(card riff.Card, blockID, deckID string, now time.Time) *Flashc
|
|||
DeckID: deckID,
|
||||
CardID: card.ID(),
|
||||
BlockID: blockID,
|
||||
State: card.GetState(),
|
||||
NextDues: nextDues,
|
||||
}
|
||||
}
|
||||
|
|
@ -632,7 +634,7 @@ func (tx *Transaction) doRemoveFlashcards(operation *Operation) (ret *TxErr) {
|
|||
deckLock.Lock()
|
||||
defer deckLock.Unlock()
|
||||
|
||||
if syncingStorages {
|
||||
if syncingStorages.Load() {
|
||||
ret = &TxErr{code: TxErrCodeDataIsSyncing}
|
||||
return
|
||||
}
|
||||
|
|
@ -744,7 +746,7 @@ func (tx *Transaction) doAddFlashcards(operation *Operation) (ret *TxErr) {
|
|||
deckLock.Lock()
|
||||
defer deckLock.Unlock()
|
||||
|
||||
if syncingStorages {
|
||||
if syncingStorages.Load() {
|
||||
ret = &TxErr{code: TxErrCodeDataIsSyncing}
|
||||
return
|
||||
}
|
||||
|
|
@ -991,6 +993,7 @@ func getDeckDueCards(deck *riff.Deck, reviewedCardIDs, blockIDs []string, newCar
|
|||
tmp = append(tmp, c)
|
||||
}
|
||||
dues = tmp
|
||||
tmp = nil
|
||||
|
||||
for _, c := range dues {
|
||||
if 0 < len(blockIDs) && !gulu.Str.Contains(c.BlockID(), blockIDs) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue