Ver Fonte

:art: Show card NextDue to the flashcard management UI https://github.com/siyuan-note/siyuan/pull/9621

Daniel há 1 ano atrás
pai
commit
cb45da4319
2 ficheiros alterados com 8 adições e 3 exclusões
  1. 7 2
      kernel/model/block.go
  2. 1 1
      kernel/model/flashcard.go

+ 7 - 2
kernel/model/block.go

@@ -70,9 +70,14 @@ type RiffCard struct {
 	Reps uint64    `json:"reps"`
 }
 
-func GetRiffCard(card *fsrs.Card) *RiffCard {
+func getRiffCard(card *fsrs.Card) *RiffCard {
+	due := card.Due
+	if due.IsZero() {
+		due = time.Now()
+	}
+
 	return &RiffCard{
-		Due:  card.Due,
+		Due:  due,
 		Reps: card.Reps,
 	}
 }

+ 1 - 1
kernel/model/flashcard.go

@@ -334,7 +334,7 @@ func getCardsBlocks(cards []riff.Card, page int) (blocks []*Block, total, pageCo
 		}
 
 		b.RiffCardID = cards[i].ID()
-		b.RiffCard = GetRiffCard(cards[i].(*riff.FSRSCard).C)
+		b.RiffCard = getRiffCard(cards[i].(*riff.FSRSCard).C)
 	}
 	return
 }