Add historical retention field to FSRS review request and update related logic

- Added `historical_retention` field to `SimulateFsrsReviewRequest` in `scheduler.proto`.
- Updated `simulator.rs` to use `req.historical_retention` instead of the removed `desired_retention`.
- Modified `FsrsOptions.svelte` to include `historicalRetention` in the options passed to the component.
This commit is contained in:
Jarrett Ye 2025-07-08 17:40:17 +08:00
parent 267f763b8e
commit d159aaa704
No known key found for this signature in database
GPG key ID: EBFC55E0C1A352BB
3 changed files with 3 additions and 2 deletions

View file

@ -404,6 +404,7 @@ message SimulateFsrsReviewRequest {
repeated float easy_days_percentages = 10; repeated float easy_days_percentages = 10;
deck_config.DeckConfig.Config.ReviewCardOrder review_order = 11; deck_config.DeckConfig.Config.ReviewCardOrder review_order = 11;
optional uint32 suspend_after_lapse_count = 12; optional uint32 suspend_after_lapse_count = 12;
float historical_retention = 13;
} }
message SimulateFsrsReviewResponse { message SimulateFsrsReviewResponse {

View file

@ -146,7 +146,6 @@ impl Collection {
let new_cards = let new_cards =
cards.iter().filter(|c| c.queue == CardQueue::New).count() + req.deck_size as usize; cards.iter().filter(|c| c.queue == CardQueue::New).count() + req.deck_size as usize;
let fsrs = FSRS::new(Some(&req.params))?; let fsrs = FSRS::new(Some(&req.params))?;
let historical_retention = req.desired_retention;
let mut converted_cards = cards let mut converted_cards = cards
.into_iter() .into_iter()
.filter(is_included_card) .filter(is_included_card)
@ -157,7 +156,7 @@ impl Collection {
.memory_state_from_sm2( .memory_state_from_sm2(
c.ease_factor(), c.ease_factor(),
c.interval as f32, c.interval as f32,
historical_retention, req.historical_retention,
) )
.ok()? .ok()?
.into(), .into(),

View file

@ -95,6 +95,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
newCardsIgnoreReviewLimit: $newCardsIgnoreReviewLimit, newCardsIgnoreReviewLimit: $newCardsIgnoreReviewLimit,
easyDaysPercentages: $config.easyDaysPercentages, easyDaysPercentages: $config.easyDaysPercentages,
reviewOrder: $config.reviewOrder, reviewOrder: $config.reviewOrder,
historicalRetention: $config.historicalRetention,
}); });
const DESIRED_RETENTION_LOW_THRESHOLD = 0.8; const DESIRED_RETENTION_LOW_THRESHOLD = 0.8;