open-spaced-repetition / swift-fsrs

Swift Package for FSRS
MIT License
27 stars 14 forks source link

Issue with re(learning) steps #13

Open tomerbeil opened 5 months ago

tomerbeil commented 5 months ago

Hi! I’ve noticed some differences between Anki’s FSRS and Swift FSRS.

In Anki, with FSRS turned on and default settings, the due date in the first review for “Again” button is 1 minute, for “Good” button — 10 minutes. This behavior is identical to the Swift version of the algorithm. However, there are changes after the first rating.

In Anki with FSRS, if I tap on “Again” button in the first review, in my next review the intervals for all ratings stay the same (1 minute for “Again”, 10 minutes for “Good). In Swift version of the algorithm, if I tap on “Again” button in the first review, in my next review the interval will be different (5 minutes for “Again”, 1 day for “Good).

The same situation with relearning. If I tap on the 'Again' button for the card with status 'review', in the next review the new interval for “Good” should be 10 minutes, not an interval in days.

I consider these as important issues. From Anki Manual:

«When you press Again, the card goes back to first step, and will be shown again approximately 1 minute later» «When you forget a review card, it is said to have 'lapsed', and the card must be relearnt. The default behaviour for lapsed reviews is to reset the interval to 1 (i.e. make it due tomorrow), and put it in the learning queue for a refresher in 10 minutes.»

Since I’m almost completely beginner in programming, it’s quite hard for me to find the reason in the code. So I would appreciate if someone can verify this problem and resolve it. Thank you very much!

ishiko732 commented 5 months ago

https://github.com/open-spaced-repetition/swift-fsrs/blob/0765052025215685b1fc920bb0b9bb93521ddd48/Sources/FSRS/FSRS.swift#L255-L265 https://github.com/open-spaced-repetition/swift-fsrs/blob/0765052025215685b1fc920bb0b9bb93521ddd48/Sources/FSRS/FSRS.swift#L162-L167

When a card with State.New is clicked Again or Hard, it will change to State.Learning, and the due time will increase from 1 to 5 minutes. image image

After a card changes from State.New to State.Learning, if Again is clicked again, it sets the interval to 5 minutes. I'm not sure if this is a bug or not, and I would like @L-M-Sherlock to confirm. Personally, I don't think whether it's 1 minute or 5 minutes would make much of a difference.

tomerbeil commented 5 months ago

@ishiko732 Thank you for the explanation!

1 minute or 5 minutes for the "Again" button — it really doesn't make much of a difference. However, as I mentioned earlier, the interval for the "Good" button in this case (when the user pressed "Again" last time) could be 1 day or more when it should be 10 minutes (because the card should have gone back to the first learning step earlier).

I don't know whether it's possible to track and change the learning step while the card is in the "learning" or "relearning" status because there isn't something like a "learningStep" field in the Card mode.

L-M-Sherlock commented 5 months ago

I don't want to implement the learning steps of Anki, because it's too complex. So the current implementation is a simple version. It even doesn't have the conception of learning steps.