Skip to content

Commit

Permalink
Merge pull request #3 from open-spaced-repetition/ef-interval-order
Browse files Browse the repository at this point in the history
Update ease factor before calculating next interval
  • Loading branch information
joshdavham authored Nov 23, 2024
2 parents 4ad06a6 + d70d0a4 commit 66316db
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "sm-2"
version = "0.2.0"
version = "0.2.1"
description = "SM-2 spaced repetition scheduler"
readme = "README.md"
authors = [{ name = "Joshua Hamilton", email = "[email protected]" }]
Expand Down
8 changes: 4 additions & 4 deletions src/sm_2/sm_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@ def review_card(card: Card, rating: int, review_datetime: datetime | None = None
else:

if rating >= 3: # correct response

# note: EF increases when rating = 5, stays the same when rating = 4 and decreases when rating = 3
card.EF = card.EF + (0.1-(5-rating)*(0.08+(5-rating)*0.02))
card.EF = max(1.3, card.EF)

if card.n == 0:

Expand All @@ -188,10 +192,6 @@ def review_card(card: Card, rating: int, review_datetime: datetime | None = None

card.n += 1

# note: EF increases when rating = 5, stays the same when rating = 4 and decreases when rating = 3
card.EF = card.EF + (0.1-(5-rating)*(0.08+(5-rating)*0.02))
card.EF = max(1.3, card.EF)

if rating >= 4:

card.due += timedelta(days=card.I)
Expand Down

0 comments on commit 66316db

Please sign in to comment.