mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 23:20:13 +01:00
🎨 Support resetting the learning progress of flashcards https://github.com/siyuan-note/siyuan/issues/9564
This commit is contained in:
parent
cb45da4319
commit
fb92772ae7
2 changed files with 7 additions and 6 deletions
|
|
@ -36,9 +36,10 @@ func resetRiffCards(c *gin.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
typ := arg["type"].(string) // notebook, tree, deck
|
typ := arg["type"].(string) // notebook, tree, deck
|
||||||
id := arg["id"].(string) // notebook ID, root ID, deck ID
|
id := arg["id"].(string) // notebook ID, root ID, deck ID
|
||||||
blockIDsArg := arg["blockIDs"] // 如果不传入 blockIDs (或者传入实参为空数组),则重置所有卡片
|
deckID := arg["deckID"].(string) // deck ID
|
||||||
|
blockIDsArg := arg["blockIDs"] // 如果不传入 blockIDs (或者传入实参为空数组),则重置所有卡片
|
||||||
var blockIDs []string
|
var blockIDs []string
|
||||||
if nil != blockIDsArg {
|
if nil != blockIDsArg {
|
||||||
for _, blockID := range blockIDsArg.([]interface{}) {
|
for _, blockID := range blockIDsArg.([]interface{}) {
|
||||||
|
|
@ -46,7 +47,7 @@ func resetRiffCards(c *gin.Context) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
model.ResetFlashcards(typ, id, blockIDs)
|
model.ResetFlashcards(typ, id, deckID, blockIDs)
|
||||||
}
|
}
|
||||||
|
|
||||||
func getNotebookRiffCards(c *gin.Context) {
|
func getNotebookRiffCards(c *gin.Context) {
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ import (
|
||||||
"github.com/siyuan-note/siyuan/kernel/util"
|
"github.com/siyuan-note/siyuan/kernel/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
func ResetFlashcards(typ, id string, blockIDs []string) {
|
func ResetFlashcards(typ, id, deckID string, blockIDs []string) {
|
||||||
// Support resetting the learning progress of flashcards https://github.com/siyuan-note/siyuan/issues/9564
|
// Support resetting the learning progress of flashcards https://github.com/siyuan-note/siyuan/issues/9564
|
||||||
|
|
||||||
if 0 < len(blockIDs) {
|
if 0 < len(blockIDs) {
|
||||||
|
|
@ -84,7 +84,7 @@ func ResetFlashcards(typ, id string, blockIDs []string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
blockIDs = gulu.Str.RemoveDuplicatedElem(blockIDs)
|
blockIDs = gulu.Str.RemoveDuplicatedElem(blockIDs)
|
||||||
resetFlashcards(id, blockIDs)
|
resetFlashcards(deckID, blockIDs)
|
||||||
}
|
}
|
||||||
|
|
||||||
func resetFlashcards(deckID string, blockIDs []string) {
|
func resetFlashcards(deckID string, blockIDs []string) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue