Whole file
open-spaced-repetition/py-fsrs
The author described this change as “Fixes type bug where difficulty became an int if it exceeded the thresholds. (#74)”. It counts as a record because the check below fails on the code as it stood at f18100d29 and passes on c97c0da51, with nothing else changed between the two runs.
Fix saved2024-12-29
Sharing licenceMIT · LICENSE
Change size+2 −2
What the code was meant to do, written into the code itself as a save note
Fixes type bug where difficulty became an int if it exceeded the thresholds. (#74)
The change
| 663 | 663 | ) | |
| 664 | 664 | ||
| 665 | 665 | # bound initial_difficulty between 1 and 10 | |
| 666 | - | initial_difficulty = min(max(initial_difficulty, 1), 10) | |
| 666 | + | initial_difficulty = min(max(initial_difficulty, 1.0), 10.0) | |
| 667 | 667 | ||
| 668 | 668 | return initial_difficulty | |
| 669 | 669 | ||
| ⋯ | |||
| 704 | 704 | next_difficulty = _mean_reversion(arg_1=arg_1, arg_2=arg_2) | |
| 705 | 705 | ||
| 706 | 706 | # bound next_difficulty between 1 and 10 | |
| 707 | - | next_difficulty = min(max(next_difficulty, 1), 10) | |
| 707 | + | next_difficulty = min(max(next_difficulty, 1.0), 10.0) | |
| 708 | 708 | ||
| 709 | 709 | return next_difficulty | |
| 710 | 710 | ||
The check that tells the two apart
fail→pass·tests/test_fsrs.py::TestPyFSRS::test_repeated_correct_reviews
Check file tests/test_fsrs.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 itf18100d29c774f981f873361d444f8db12e88f77
Broken version dated2024-12-19
Modulefsrs.fsrs
Units changedScheduler
Fingerprint90f15ea721747288
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.