|
@@ -513,7 +513,7 @@ type Flashcard struct {
|
|
NextDues map[riff.Rating]string `json:"nextDues"`
|
|
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{}
|
|
nextDues := map[riff.Rating]string{}
|
|
for rating, due := range card.NextDues() {
|
|
for rating, due := range card.NextDues() {
|
|
nextDues[rating] = strings.TrimSpace(util.HumanizeDiffTime(due, now, Conf.Lang))
|
|
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{
|
|
return &Flashcard{
|
|
DeckID: deckID,
|
|
DeckID: deckID,
|
|
CardID: card.ID(),
|
|
CardID: card.ID(),
|
|
- BlockID: blockID,
|
|
|
|
|
|
+ BlockID: card.BlockID(),
|
|
Lapses: card.GetLapses(),
|
|
Lapses: card.GetLapses(),
|
|
Reps: card.GetReps(),
|
|
Reps: card.GetReps(),
|
|
State: card.GetState(),
|
|
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)
|
|
cards, unreviewedCnt, unreviewedNewCardCnt, unreviewedOldCardCnt := getDeckDueCards(deck, reviewedCardIDs, treeBlockIDs, Conf.Flashcard.NewCardLimit, Conf.Flashcard.ReviewCardLimit, Conf.Flashcard.ReviewMode)
|
|
now := time.Now()
|
|
now := time.Now()
|
|
for _, card := range cards {
|
|
for _, card := range cards {
|
|
- ret = append(ret, newFlashcard(card, card.BlockID(), builtinDeckID, now))
|
|
|
|
|
|
+ ret = append(ret, newFlashcard(card, builtinDeckID, now))
|
|
}
|
|
}
|
|
if 1 > len(ret) {
|
|
if 1 > len(ret) {
|
|
ret = []*Flashcard{}
|
|
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)
|
|
cards, unreviewedCnt, unreviewedNewCardCnt, unreviewedOldCardCnt := getDeckDueCards(deck, reviewedCardIDs, treeBlockIDs, newCardLimit, reviewCardLimit, Conf.Flashcard.ReviewMode)
|
|
now := time.Now()
|
|
now := time.Now()
|
|
for _, card := range cards {
|
|
for _, card := range cards {
|
|
- ret = append(ret, newFlashcard(card, card.BlockID(), builtinDeckID, now))
|
|
|
|
|
|
+ ret = append(ret, newFlashcard(card, builtinDeckID, now))
|
|
}
|
|
}
|
|
if 1 > len(ret) {
|
|
if 1 > len(ret) {
|
|
ret = []*Flashcard{}
|
|
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)
|
|
cards, unreviewedCnt, unreviewedNewCardCnt, unreviewedOldCardCnt := getDeckDueCards(deck, reviewedCardIDs, nil, Conf.Flashcard.NewCardLimit, Conf.Flashcard.ReviewCardLimit, Conf.Flashcard.ReviewMode)
|
|
now := time.Now()
|
|
now := time.Now()
|
|
for _, card := range cards {
|
|
for _, card := range cards {
|
|
- ret = append(ret, newFlashcard(card, card.BlockID(), deckID, now))
|
|
|
|
|
|
+ ret = append(ret, newFlashcard(card, deckID, now))
|
|
}
|
|
}
|
|
if 1 > len(ret) {
|
|
if 1 > len(ret) {
|
|
ret = []*Flashcard{}
|
|
ret = []*Flashcard{}
|
|
@@ -707,7 +707,7 @@ func getAllDueFlashcards(reviewedCardIDs []string) (ret []*Flashcard, unreviewed
|
|
unreviewedNewCardCount += unreviewedNewCardCnt
|
|
unreviewedNewCardCount += unreviewedNewCardCnt
|
|
unreviewedOldCardCount += unreviewedOldCardCnt
|
|
unreviewedOldCardCount += unreviewedOldCardCnt
|
|
for _, card := range cards {
|
|
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) {
|
|
if 1 > len(ret) {
|