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
| 447 | 447 | ||
| 448 | 448 | # calculate the card's next interval | |
| 449 | 449 | # 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 | |
| 451 | 451 | # 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): | |
| 453 | 453 | card.state = State.Review | |
| 454 | 454 | card.step = None | |
| 455 | 455 | ||
| ⋯ | |||
| 559 | 559 | ||
| 560 | 560 | # calculate the card's next interval | |
| 561 | 561 | # 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 | |
| 563 | 563 | # 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( | |
| 565 | 565 | self.relearning_steps | |
| 566 | 566 | ): | |
| 567 | 567 | card.state = State.Review | |
The check that tells the two apart
fail→pass·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.