feat(scheduling): add ReviewHistoryToEntries and simplify Reschedule for non-advanced users#63
Draft
cantalupo555 wants to merge 3 commits into
Draft
feat(scheduling): add ReviewHistoryToEntries and simplify Reschedule for non-advanced users#63cantalupo555 wants to merge 3 commits into
cantalupo555 wants to merge 3 commits into
Conversation
2 tasks
Member
Author
|
@ishiko732 This was based on your suggestion. |
ishiko732
reviewed
May 8, 2026
Comment on lines
+3399
to
+3404
| r1 := time.Date(2024, 9, 13, 0, 0, 0, 0, time.UTC) | ||
| manualDue := time.Date(2024, 9, 28, 0, 0, 0, 0, time.UTC) | ||
| reviews := []ReviewHistory{ | ||
| {Rating: Manual, Review: r1, State: StatePtr(Review), Stability: 10.0, Difficulty: 5.0, Due: manualDue}, | ||
| } | ||
|
|
Member
There was a problem hiding this comment.
I don’t want to make it that complicated. In fact, I haven’t seen anyone manually adjust DS.
The intended use of reschedule is to refresh a card’s next due time after the parameters have been updated.
Open-source projects with over 50 stars that depend on ts-fsrs don’t seem to use the reschedule method.
ishiko732
reviewed
May 8, 2026
Comment on lines
+78
to
+81
| // | ||
| // Returns an error if the list is empty, any review has a zero timestamp, | ||
| // any rating is [Manual] or outside the range [Again–Easy], or any computed | ||
| // DeltaT is negative (indicating out-of-order timestamps). |
…eduling - Introduces ReviewHistoryToEntries to convert timestamp-based []ReviewHistory into DeltaT-based []ReviewEntries - Validates input: empty slices, zero timestamps, Manual ratings, invalid ratings, negative DeltaT - Cross-validates against Reschedule to ensure identical stability/difficulty
…document simpler alternative - Added input validation loop for rating range and zero review times - Fixed calculateManualRecord to propagate errors instead of silently discarding them - Updated godoc to recommend MemoryState + ReviewHistoryToEntries as simpler alternative - Added 5 validation test cases covering invalid rating, zero review time, and manual entries
…tries edge cases - Add single-entry and boundary rating tests for ReviewHistoryToEntries - Add manual non-New as first review test verifying zero elapsed days - Add all-manual RescheduleItem field assertions - Add manual Learning/Relearning zero-stability fallback tests - Add handleManualRating logDue fallback test for zero LastReview - Add error message content verification test
7e4eb00 to
ef46bb8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds ReviewHistoryToEntries() converter to simplify scheduling for non-advanced users, and improves Reschedule() with better validation, error handling, and documentation.
Motivation
Reschedule() was identified as overly complex for typical use cases. This PR provides a simpler alternative path using MemoryState()/HistoricalMemoryStates() while maintaining full backward compatibility. It also fixes a pre-existing bug where calculateManualRecord silently discarded errors.
Changes Made
Testing
Breaking Changes
None — this is purely additive. Existing Reschedule() behavior is unchanged; new ReviewHistoryToEntries() provides a simpler scheduling path.
Closes #53