-
Notifications
You must be signed in to change notification settings - Fork 1
/
flashback.go
55 lines (47 loc) · 1.36 KB
/
flashback.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package flashback
import (
"context"
"time"
fb "github.com/FlashbackSRS/flashback-model"
"github.com/FlashbackSRS/flashback/webclient/views/studyview"
)
// AnswerQuality represents the SM-2 quality of the answer. See here:
// https://www.supermemo.com/english/ol/sm2.htm
type AnswerQuality int
// Answer qualities are borrowed from the SM2 algorithm.
const (
// Complete Blackout
AnswerBlackout AnswerQuality = iota
// incorrect response; the correct one remembered
AnswerIncorrectRemembered
// incorrect response; where the correct one seemed easy to recall
AnswerIncorrectEasy
// correct response recalled with serious difficulty
AnswerCorrectDifficult
// correct response after a hesitation
AnswerCorrect
// perfect response
AnswerPerfect
)
// Ease factor options
const (
InitialEase float32 = 2.5
MaxEase float32 = 2.5
MinEase float32 = 1.3
)
// Interval options
const (
InitialInterval = fb.Interval(24 * fb.Hour)
SecondInterval = fb.Interval(6 * fb.Day)
)
// Lapse options
const (
LapseInterval = fb.Interval(10 * fb.Minute)
)
// CardView represents a view of a card or card-like object.
type CardView interface {
DocID() string
Buttons(face int) (studyview.ButtonMap, error)
Body(ctx context.Context, face int) (body string, err error)
Action(ctx context.Context, face *int, startTime time.Time, query interface{}) (done bool, err error)
}