Skip to content

Commit

Permalink
🎨 Persist flashcard review log records siyuan-note/siyuan#8833
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Jul 26, 2023
1 parent 588f715 commit 9d6e0fb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions deck.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,14 @@ func (deck *Deck) Save() (err error) {
return
}

// SaveLog 保存闪卡包的复习日志。
func (deck *Deck) SaveLog(log *Log) (err error) {
deck.lock.Lock()
defer deck.lock.Unlock()

return deck.store.SaveLog(log)
}

// Review 复习一张闪卡,rating 为复习评分结果。
func (deck *Deck) Review(cardID string, rating Rating) (ret *Log) {
deck.lock.Lock()
Expand Down
3 changes: 3 additions & 0 deletions store.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ type Store interface {
// Save 将全部闪卡从内存保存到持久化存储中。
Save() error

// SaveLog 保存复习日志。
SaveLog(log *Log) error

// GetSaveDir 获取数据文件夹路径。
GetSaveDir() string
}
Expand Down

0 comments on commit 9d6e0fb

Please sign in to comment.