mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-05 07:01:48 +01:00
🎨 支持配置闪卡 https://github.com/siyuan-note/siyuan/issues/7704 https://github.com/siyuan-note/siyuan/issues/7695 https://github.com/siyuan-note/siyuan/issues/7703 https://github.com/siyuan-note/siyuan/issues/7701 https://github.com/siyuan-note/siyuan/issues/7702 https://github.com/siyuan-note/siyuan/issues/7724
This commit is contained in:
parent
e83b41786a
commit
4f3766af15
11 changed files with 54 additions and 48 deletions
|
|
@ -95,12 +95,12 @@ func setFlashcard(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
if 1 > flashcard.DailyNewCardLimit {
|
||||
flashcard.DailyNewCardLimit = 1
|
||||
if 1 > flashcard.NewCardLimit {
|
||||
flashcard.NewCardLimit = 1
|
||||
}
|
||||
|
||||
if 1 > flashcard.DailyReviewCardLimit {
|
||||
flashcard.DailyReviewCardLimit = 1
|
||||
if 1 > flashcard.ReviewCardLimit {
|
||||
flashcard.ReviewCardLimit = 1
|
||||
}
|
||||
|
||||
model.Conf.Flashcard = flashcard
|
||||
|
|
|
|||
|
|
@ -17,19 +17,19 @@
|
|||
package conf
|
||||
|
||||
type Flashcard struct {
|
||||
DailyNewCardLimit int `json:"dailyNewCardLimit"` // 每日新卡上限 https://github.com/siyuan-note/siyuan/issues/7695
|
||||
DailyReviewCardLimit int `json:"dailyReviewCardLimit"` // 每日复习卡上限 https://github.com/siyuan-note/siyuan/issues/7703
|
||||
List bool `json:"list"` // 是否启用列表块制卡 https://github.com/siyuan-note/siyuan/issues/7701
|
||||
SuperBlock bool `json:"superBlock"` // 是否启用超级块制卡 https://github.com/siyuan-note/siyuan/issues/7702
|
||||
Deck bool `json:"deck"` // 是否启用卡包制卡 https://github.com/siyuan-note/siyuan/issues/7724
|
||||
NewCardLimit int `json:"newCardLimit"` // 新卡上限 https://github.com/siyuan-note/siyuan/issues/7695
|
||||
ReviewCardLimit int `json:"reviewCardLimit"` // 复习卡上限 https://github.com/siyuan-note/siyuan/issues/7703
|
||||
List bool `json:"list"` // 是否启用列表块制卡 https://github.com/siyuan-note/siyuan/issues/7701
|
||||
SuperBlock bool `json:"superBlock"` // 是否启用超级块制卡 https://github.com/siyuan-note/siyuan/issues/7702
|
||||
Deck bool `json:"deck"` // 是否启用卡包制卡 https://github.com/siyuan-note/siyuan/issues/7724
|
||||
}
|
||||
|
||||
func NewFlashcard() *Flashcard {
|
||||
return &Flashcard{
|
||||
DailyNewCardLimit: 20,
|
||||
DailyReviewCardLimit: 200,
|
||||
List: true,
|
||||
SuperBlock: true,
|
||||
Deck: false,
|
||||
NewCardLimit: 20,
|
||||
ReviewCardLimit: 200,
|
||||
List: true,
|
||||
SuperBlock: true,
|
||||
Deck: false,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -318,11 +318,11 @@ func InitConf() {
|
|||
if nil == Conf.Flashcard {
|
||||
Conf.Flashcard = conf.NewFlashcard()
|
||||
}
|
||||
if 1 > Conf.Flashcard.DailyNewCardLimit {
|
||||
Conf.Flashcard.DailyNewCardLimit = 20
|
||||
if 1 > Conf.Flashcard.NewCardLimit {
|
||||
Conf.Flashcard.NewCardLimit = 20
|
||||
}
|
||||
if 1 > Conf.Flashcard.DailyReviewCardLimit {
|
||||
Conf.Flashcard.DailyReviewCardLimit = 200
|
||||
if 1 > Conf.Flashcard.ReviewCardLimit {
|
||||
Conf.Flashcard.ReviewCardLimit = 200
|
||||
}
|
||||
|
||||
if nil == Conf.AI {
|
||||
|
|
|
|||
|
|
@ -915,8 +915,14 @@ func getDeckDueCards(deck *riff.Deck) (ret []riff.Card) {
|
|||
fsrsCard := c.Impl().(*fsrs.Card)
|
||||
if fsrs.New == fsrsCard.State {
|
||||
newCount++
|
||||
if newCount > Conf.Flashcard.NewCardLimit {
|
||||
continue
|
||||
}
|
||||
} else {
|
||||
reviewCount++
|
||||
if reviewCount > Conf.Flashcard.ReviewCardLimit {
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
ret = append(ret, c)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue