Whole file

open-spaced-repetition/py-fsrs

The author described this change as Fix multiple schedulers edge case (#90). It counts as a record because the check below fails on the code as it stood at ed19dc174 and passes on e8b498dcd, with nothing else changed between the two runs.

Fix saved2025-02-06
Sharing licenceMIT · LICENSE
Change size+4 4

What the code was meant to do, written into the code itself as a save note

Fix multiple schedulers edge case (#90)

The change

447447
448448 # calculate the card's next interval
449449 # len(self.learning_steps) == 0: no learning steps defined so move card to Review state
450- # card.step > len(self.learning_steps): handles the edge-case when a card was originally scheduled with a scheduler with more
450+ # card.step >= len(self.learning_steps): handles the edge-case when a card was originally scheduled with a scheduler with more
451451 # learning steps than the current scheduler
452- if len(self.learning_steps) == 0 or card.step > len(self.learning_steps):
452+ if len(self.learning_steps) == 0 or card.step >= len(self.learning_steps):
453453 card.state = State.Review
454454 card.step = None
455455
559559
560560 # calculate the card's next interval
561561 # len(self.relearning_steps) == 0: no relearning steps defined so move card to Review state
562- # card.step > len(self.relearning_steps): handles the edge-case when a card was originally scheduled with a scheduler with more
562+ # card.step >= len(self.relearning_steps): handles the edge-case when a card was originally scheduled with a scheduler with more
563563 # relearning steps than the current scheduler
564- if len(self.relearning_steps) == 0 or card.step > len(
564+ if len(self.relearning_steps) == 0 or card.step >= len(
565565 self.relearning_steps
566566 ):
567567 card.state = State.Review

The check that tells the two apart

failpass·tests/test_basic.py::TestPyFSRS::test_one_card_multiple_schedulers

Check file tests/test_basic.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before ited19dc17424511f0341bb2932821fc544c410f63
Broken version dated2025-02-03
Modulefsrs.fsrs
Units changedScheduler
Fingerprint572da54d2974fe9b
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.

Other bugs found in open-spaced-repetition/py-fsrs