From 2b55882cceb9ff76c777a55ff16983271426766f Mon Sep 17 00:00:00 2001 From: Jarrett Ye Date: Mon, 4 Aug 2025 14:01:26 +0800 Subject: [PATCH] Fix/use real step count to simulate (#4240) * Fix/use real step count to simulate * Update licenses.json --- Cargo.lock | 46 +++++++++++------------ Cargo.toml | 2 +- cargo/licenses.json | 6 +-- proto/anki/scheduler.proto | 2 + rslib/src/scheduler/fsrs/simulator.rs | 4 +- ts/routes/deck-options/FsrsOptions.svelte | 2 + 6 files changed, 33 insertions(+), 29 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f698a4ce4..e9c09b75b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -130,7 +130,7 @@ dependencies = [ "prost", "prost-reflect", "pulldown-cmark 0.13.0", - "rand 0.9.1", + "rand 0.9.2", "rayon", "regex", "reqwest 0.12.20", @@ -144,7 +144,7 @@ dependencies = [ "serde_tuple", "sha1", "snafu", - "strum 0.27.1", + "strum 0.27.2", "syn 2.0.103", "tempfile", "tokio", @@ -220,7 +220,7 @@ dependencies = [ "prost-types", "serde", "snafu", - "strum 0.27.1", + "strum 0.27.2", ] [[package]] @@ -706,7 +706,7 @@ dependencies = [ "log", "num-traits", "portable-atomic-util", - "rand 0.9.1", + "rand 0.9.2", "rmp-serde", "serde", "serde_json", @@ -732,7 +732,7 @@ dependencies = [ "hashbrown 0.15.4", "log", "num-traits", - "rand 0.9.1", + "rand 0.9.2", "serde", "spin 0.10.0", "text_placeholder", @@ -762,12 +762,12 @@ dependencies = [ "csv", "derive-new 0.7.0", "dirs 6.0.0", - "rand 0.9.1", + "rand 0.9.2", "rmp-serde", "sanitize-filename 0.6.0", "serde", "serde_json", - "strum 0.27.1", + "strum 0.27.2", "tempfile", "thiserror 2.0.12", ] @@ -817,7 +817,7 @@ dependencies = [ "num-traits", "paste", "portable-atomic-util", - "rand 0.9.1", + "rand 0.9.2", "seq-macro", "spin 0.10.0", ] @@ -865,7 +865,7 @@ dependencies = [ "half", "hashbrown 0.15.4", "num-traits", - "rand 0.9.1", + "rand 0.9.2", "rand_distr", "serde", "serde_bytes", @@ -959,7 +959,7 @@ dependencies = [ "memmap2", "num-traits", "num_cpus", - "rand 0.9.1", + "rand 0.9.2", "rand_distr", "rayon", "safetensors", @@ -1403,7 +1403,7 @@ dependencies = [ "log", "num-traits", "portable-atomic", - "rand 0.9.1", + "rand 0.9.2", "sanitize-filename 0.5.0", "serde", "serde_json", @@ -2214,20 +2214,20 @@ dependencies = [ [[package]] name = "fsrs" -version = "5.0.0" +version = "5.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f590cfcbe25079bb54a39900f45e6e308935bd6067249ce00d265b280465cde2" +checksum = "df5aee516ebf9d4968364363b092371f988cd9fb628f7cae94ea422b6dd52f9c" dependencies = [ "burn", "itertools 0.14.0", "log", "ndarray", "priority-queue", - "rand 0.9.1", + "rand 0.9.2", "rayon", "serde", "snafu", - "strum 0.27.1", + "strum 0.27.2", ] [[package]] @@ -2804,7 +2804,7 @@ dependencies = [ "cfg-if", "crunchy", "num-traits", - "rand 0.9.1", + "rand 0.9.2", "rand_distr", "serde", ] @@ -3658,7 +3658,7 @@ dependencies = [ "linkcheck", "regex", "reqwest 0.12.20", - "strum 0.27.1", + "strum 0.27.2", "tokio", ] @@ -5096,7 +5096,7 @@ dependencies = [ "bytes", "getrandom 0.3.3", "lru-slab", - "rand 0.9.1", + "rand 0.9.2", "ring", "rustc-hash 2.1.1", "rustls", @@ -5150,9 +5150,9 @@ dependencies = [ [[package]] name = "rand" -version = "0.9.1" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fbfd9d094a40bf3ae768db9361049ace4c0e04a4fd6b359518bd7b73a73dd97" +checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ "rand_chacha 0.9.0", "rand_core 0.9.3", @@ -5203,7 +5203,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a8615d50dcf34fa31f7ab52692afec947c4dd0ab803cc87cb3b0b4570ff7463" dependencies = [ "num-traits", - "rand 0.9.1", + "rand 0.9.2", ] [[package]] @@ -6113,9 +6113,9 @@ dependencies = [ [[package]] name = "strum" -version = "0.27.1" +version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f64def088c51c9510a8579e3c5d67c65349dcf755e5479ad3d010aa6454e2c32" +checksum = "af23d6f6c1a224baef9d3f61e287d2761385a5b88fdab4eb4c6f11aeb54c4bcf" dependencies = [ "strum_macros 0.27.1", ] diff --git a/Cargo.toml b/Cargo.toml index f62a71023..4a6634909 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,7 +33,7 @@ git = "https://github.com/ankitects/linkcheck.git" rev = "184b2ca50ed39ca43da13f0b830a463861adb9ca" [workspace.dependencies.fsrs] -version = "5.0.0" +version = "5.0.1" # git = "https://github.com/open-spaced-repetition/fsrs-rs.git" # branch = "Refactor/expected_workload_via_dp" # rev = "a7f7efc10f0a26b14ee348cc7402155685f2a24f" diff --git a/cargo/licenses.json b/cargo/licenses.json index e7b61a5fe..7bd0d984a 100644 --- a/cargo/licenses.json +++ b/cargo/licenses.json @@ -1450,7 +1450,7 @@ }, { "name": "fsrs", - "version": "5.0.0", + "version": "5.0.1", "authors": "Open Spaced Repetition", "repository": "https://github.com/open-spaced-repetition/fsrs-rs", "license": "BSD-3-Clause", @@ -3322,7 +3322,7 @@ }, { "name": "rand", - "version": "0.9.1", + "version": "0.9.2", "authors": "The Rand Project Developers|The Rust Project Developers", "repository": "https://github.com/rust-random/rand", "license": "Apache-2.0 OR MIT", @@ -4132,7 +4132,7 @@ }, { "name": "strum", - "version": "0.27.1", + "version": "0.27.2", "authors": "Peter Glotfelty ", "repository": "https://github.com/Peternator7/strum", "license": "MIT", diff --git a/proto/anki/scheduler.proto b/proto/anki/scheduler.proto index a88cd468c..34b350642 100644 --- a/proto/anki/scheduler.proto +++ b/proto/anki/scheduler.proto @@ -407,6 +407,8 @@ message SimulateFsrsReviewRequest { deck_config.DeckConfig.Config.ReviewCardOrder review_order = 11; optional uint32 suspend_after_lapse_count = 12; float historical_retention = 13; + uint32 learning_step_count = 14; + uint32 relearning_step_count = 15; } message SimulateFsrsReviewResponse { diff --git a/rslib/src/scheduler/fsrs/simulator.rs b/rslib/src/scheduler/fsrs/simulator.rs index 3b173939b..262768dee 100644 --- a/rslib/src/scheduler/fsrs/simulator.rs +++ b/rslib/src/scheduler/fsrs/simulator.rs @@ -237,8 +237,8 @@ impl Collection { learning_step_transitions: p.learning_step_transitions, relearning_step_transitions: p.relearning_step_transitions, state_rating_costs: p.state_rating_costs, - learning_step_count: p.learning_step_count, - relearning_step_count: p.relearning_step_count, + learning_step_count: req.learning_step_count as usize, + relearning_step_count: req.relearning_step_count as usize, }; Ok((config, converted_cards)) diff --git a/ts/routes/deck-options/FsrsOptions.svelte b/ts/routes/deck-options/FsrsOptions.svelte index d22a903ed..a166f2081 100644 --- a/ts/routes/deck-options/FsrsOptions.svelte +++ b/ts/routes/deck-options/FsrsOptions.svelte @@ -113,6 +113,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html easyDaysPercentages: $config.easyDaysPercentages, reviewOrder: $config.reviewOrder, historicalRetention: $config.historicalRetention, + learningStepCount: $config.learnSteps.length, + relearningStepCount: $config.relearnSteps.length, }); const DESIRED_RETENTION_LOW_THRESHOLD = 0.8;