From 9d6e0fb30d0b694bf705d55c6df0b0312c9888a5 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Thu, 27 Jul 2023 00:47:47 +0800 Subject: [PATCH] :art: Persist flashcard review log records https://github.com/siyuan-note/siyuan/issues/8833 --- deck.go | 8 ++++++++ store.go | 3 +++ 2 files changed, 11 insertions(+) diff --git a/deck.go b/deck.go index 86ca36d..b99d41d 100644 --- a/deck.go +++ b/deck.go @@ -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() diff --git a/store.go b/store.go index b84055c..dd0b8bc 100644 --- a/store.go +++ b/store.go @@ -74,6 +74,9 @@ type Store interface { // Save 将全部闪卡从内存保存到持久化存储中。 Save() error + // SaveLog 保存复习日志。 + SaveLog(log *Log) error + // GetSaveDir 获取数据文件夹路径。 GetSaveDir() string }