🎨 Persist flashcard review log records https://github.com/siyuan-note/siyuan/issues/8833
This commit is contained in:
parent
91b3870a5b
commit
4ac9278a14
3 changed files with 10 additions and 10 deletions
|
@ -51,7 +51,7 @@ require (
|
|||
github.com/siyuan-note/filelock v0.0.0-20230615140405-d05a21d49524
|
||||
github.com/siyuan-note/httpclient v0.0.0-20230726100424-dca968525ec6
|
||||
github.com/siyuan-note/logging v0.0.0-20230327073243-ebe83aec1493
|
||||
github.com/siyuan-note/riff v0.0.0-20230516073320-b440b8feaabd
|
||||
github.com/siyuan-note/riff v0.0.0-20230726165442-33fecb5dcf9d
|
||||
github.com/steambap/captcha v1.4.1
|
||||
github.com/studio-b12/gowebdav v0.9.0
|
||||
github.com/vmihailenco/msgpack/v5 v5.3.5
|
||||
|
|
|
@ -290,10 +290,6 @@ github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5g
|
|||
github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
|
||||
github.com/shurcooL/gofontwoff v0.0.0-20181114050219-180f79e6909d h1:lvCTyBbr36+tqMccdGMwuEU+hjux/zL6xSmf5S9ITaA=
|
||||
github.com/shurcooL/gofontwoff v0.0.0-20181114050219-180f79e6909d/go.mod h1:05UtEgK5zq39gLST6uB0cf3NEHjETfB4Fgr3Gx5R9Vw=
|
||||
github.com/siyuan-note/dejavu v0.0.0-20230726100545-ae7efdf72dc6 h1:gr5xMKR0h2+AnWIpKKBHvyeztVaQiZNsiNlFpmHO2Hw=
|
||||
github.com/siyuan-note/dejavu v0.0.0-20230726100545-ae7efdf72dc6/go.mod h1:9IW5sPUKd2bLtdKKhvCBAQEtKKtqMy94hZ5DIP9SwfE=
|
||||
github.com/siyuan-note/dejavu v0.0.0-20230726101238-8af49418073e h1:ssNcALG/+uEtc1mXadZIz0wumfQ4soS/TsKmLpv4unw=
|
||||
github.com/siyuan-note/dejavu v0.0.0-20230726101238-8af49418073e/go.mod h1:9IW5sPUKd2bLtdKKhvCBAQEtKKtqMy94hZ5DIP9SwfE=
|
||||
github.com/siyuan-note/dejavu v0.0.0-20230726101657-a7de20433ff9 h1:VtAhOSiyxGdj7lRkIiNy5Yr3Rw1+5bHrQOZwTXA+S2w=
|
||||
github.com/siyuan-note/dejavu v0.0.0-20230726101657-a7de20433ff9/go.mod h1:9IW5sPUKd2bLtdKKhvCBAQEtKKtqMy94hZ5DIP9SwfE=
|
||||
github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75 h1:Bi7/7f29LW+Fm0cHc0J1NO1cZqyJwljSWVmfOqVZgaE=
|
||||
|
@ -306,8 +302,8 @@ github.com/siyuan-note/httpclient v0.0.0-20230726100424-dca968525ec6 h1:h96nJtx5
|
|||
github.com/siyuan-note/httpclient v0.0.0-20230726100424-dca968525ec6/go.mod h1:NBC9D4kBDDHJk00trpUBl7bVedYkjGk7TEsfVXyr6jg=
|
||||
github.com/siyuan-note/logging v0.0.0-20230327073243-ebe83aec1493 h1:oaN5b0WDFkjdBgGxmmBnMrtZxaJ76LZLwhQSZnznJMI=
|
||||
github.com/siyuan-note/logging v0.0.0-20230327073243-ebe83aec1493/go.mod h1:6mRFtAAvYPn3cDzqvyv+t8BVPGqpONDMMb5ywOhY1D4=
|
||||
github.com/siyuan-note/riff v0.0.0-20230516073320-b440b8feaabd h1:mBNAqQ7B9cA+tpyoE0gActVP690unEkJMdb1L48olaI=
|
||||
github.com/siyuan-note/riff v0.0.0-20230516073320-b440b8feaabd/go.mod h1:VZ2C485pcV1Uz89lq2DDBgoxmFp7dFC7FEyA+55Robs=
|
||||
github.com/siyuan-note/riff v0.0.0-20230726165442-33fecb5dcf9d h1:R3M1PM5tVhKwnRob/bbcXmhQPguae/XjkqOJlgXAPmA=
|
||||
github.com/siyuan-note/riff v0.0.0-20230726165442-33fecb5dcf9d/go.mod h1:OSs9s7tR+nOSnf/3Y3pSkA9LMKr5zGdwpWGTlRVQ9l0=
|
||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
|
||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
||||
github.com/smartystreets/goconvey v1.6.7 h1:I6tZjLXD2Q1kjvNbIzB1wvQBsXmKXiVrhpRE8ZjP5jY=
|
||||
|
|
|
@ -272,13 +272,17 @@ func ReviewFlashcard(deckID, cardID string, rating riff.Rating, reviewedCardIDs
|
|||
reviewCardCache[cardID] = card
|
||||
}
|
||||
|
||||
deck.Review(cardID, rating)
|
||||
err = deck.Save()
|
||||
if nil != err {
|
||||
log := deck.Review(cardID, rating)
|
||||
if err = deck.Save(); nil != err {
|
||||
logging.LogErrorf("save deck [%s] failed: %s", deckID, err)
|
||||
return
|
||||
}
|
||||
|
||||
if err = deck.SaveLog(log); nil != err {
|
||||
logging.LogErrorf("save review log [%s] failed: %s", deckID, err)
|
||||
return
|
||||
}
|
||||
|
||||
dueCards, _ := getDueFlashcards(deckID, reviewedCardIDs)
|
||||
if 1 > len(dueCards) {
|
||||
// 该卡包中没有待复习的卡片了,说明最后一张卡片已经复习完了,清空撤销缓存和跳过缓存
|
||||
|
|
Loading…
Add table
Reference in a new issue