From 342f76484053d2f180aa67450dc8618774ba2e35 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Thu, 16 Nov 2023 23:59:46 +0800 Subject: [PATCH] :art: Support resetting the learning progress of flashcards https://github.com/siyuan-note/siyuan/issues/9564 --- kernel/model/flashcard.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/kernel/model/flashcard.go b/kernel/model/flashcard.go index 240727ba0..191459133 100644 --- a/kernel/model/flashcard.go +++ b/kernel/model/flashcard.go @@ -44,10 +44,20 @@ func ResetFlashcards(typ, id, deckID string, blockIDs []string) { if 0 < len(blockIDs) { if "" == deckID { + for _, deck := range Decks { + allBlockIDs := deck.GetBlockIDs() + for _, blockID := range blockIDs { + if gulu.Str.Contains(blockID, allBlockIDs) { + deckID = deck.ID + break + } + } + resetFlashcards(deckID, blockIDs) + } deckID = builtinDeckID + } else { + resetFlashcards(deckID, blockIDs) } - - resetFlashcards(deckID, blockIDs) return }