mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 14:40:12 +01:00
🎨 Improve FSRS weight initialization https://github.com/siyuan-note/siyuan/issues/16181
Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
parent
426be24f54
commit
ddfc1cbd66
4 changed files with 46 additions and 15 deletions
|
|
@ -41,14 +41,6 @@ type Flashcard struct {
|
|||
|
||||
func NewFlashcard() *Flashcard {
|
||||
param := fsrs.DefaultParam()
|
||||
weightsBuilder := bytes.Buffer{}
|
||||
for i, w := range param.W {
|
||||
weightsBuilder.WriteString(fmt.Sprintf("%.2f", w))
|
||||
if i < len(param.W)-1 {
|
||||
weightsBuilder.WriteString(", ")
|
||||
}
|
||||
}
|
||||
|
||||
return &Flashcard{
|
||||
NewCardLimit: 20,
|
||||
ReviewCardLimit: 200,
|
||||
|
|
@ -60,6 +52,18 @@ func NewFlashcard() *Flashcard {
|
|||
ReviewMode: 0,
|
||||
RequestRetention: param.RequestRetention,
|
||||
MaximumInterval: int(param.MaximumInterval),
|
||||
Weights: weightsBuilder.String(),
|
||||
Weights: DefaultFSRSWeights(),
|
||||
}
|
||||
}
|
||||
|
||||
func DefaultFSRSWeights() string {
|
||||
buf := bytes.Buffer{}
|
||||
defaultWs := fsrs.DefaultWeights()
|
||||
for i, w := range defaultWs {
|
||||
buf.WriteString(fmt.Sprintf("%v", w))
|
||||
if i < len(defaultWs)-1 {
|
||||
buf.WriteString(", ")
|
||||
}
|
||||
}
|
||||
return buf.String()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue