Skip to content

Commit

Permalink
🎨 Distinguish between new cards and review cards during spaced repeti…
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Dec 22, 2023
1 parent 241358f commit 1f1b309
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
5 changes: 0 additions & 5 deletions card.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ type Card interface {
type BaseCard struct {
CID string
BID string
S State
NDues map[Rating]time.Time
}

Expand All @@ -65,7 +64,3 @@ func (card *BaseCard) ID() string {
func (card *BaseCard) BlockID() string {
return card.BID
}

func (card *BaseCard) GetState() State {
return card.S
}
7 changes: 5 additions & 2 deletions fsrs_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (store *FSRSStore) AddCard(id, blockID string) Card {
defer store.lock.Unlock()

c := fsrs.NewCard()
card := &FSRSCard{BaseCard: &BaseCard{id, blockID, State(c.State), nil}, C: &c}
card := &FSRSCard{BaseCard: &BaseCard{id, blockID, nil}, C: &c}
store.cards[id] = card
return card
}
Expand Down Expand Up @@ -191,7 +191,6 @@ func (store *FSRSStore) Review(cardId string, rating Rating) (ret *Log) {
schedulingInfo := store.params.Repeat(*card.C, now)
updated := schedulingInfo[fsrs.Rating(rating)].Card
card.SetImpl(&updated)
card.S = State(updated.State)
store.cards[cardId] = card

reviewLog := schedulingInfo[fsrs.Rating(rating)].ReviewLog
Expand Down Expand Up @@ -327,3 +326,7 @@ func (card *FSRSCard) Impl() interface{} {
func (card *FSRSCard) SetImpl(c interface{}) {
card.C = c.(*fsrs.Card)
}

func (card *FSRSCard) GetState() State {
return State(card.C.State)
}

0 comments on commit 1f1b309

Please sign in to comment.