Skip to content

Commit 90f2e06

Browse files
authored
Fix/missing-simulator-decay-for-FSRS-5 (#3956)
1 parent 6d0e52e commit 90f2e06

File tree

4 files changed

+15
-17
lines changed

4 files changed

+15
-17
lines changed

Cargo.lock

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ git = "https://github.com/ankitects/linkcheck.git"
3535
rev = "184b2ca50ed39ca43da13f0b830a463861adb9ca"
3636

3737
[workspace.dependencies.fsrs]
38-
version = "3.0.0"
39-
# git = "https://github.com/open-spaced-repetition/fsrs-rs.git"
40-
# rev = "c7717682997a8a6d53d97c7196281e745c5b3c8e"
38+
# version = "3.0.0"
39+
git = "https://github.com/open-spaced-repetition/fsrs-rs.git"
40+
rev = "2fb2ac7f7a4d14d07663fe5698ba5e95e3f78ebd"
4141
# path = "../open-spaced-repetition/fsrs-rs"
4242

4343
[workspace.dependencies]

cargo/licenses.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1360,7 +1360,7 @@
13601360
},
13611361
{
13621362
"name": "fsrs",
1363-
"version": "3.0.0",
1363+
"version": "4.0.0",
13641364
"authors": "Open Spaced Repetition",
13651365
"repository": "https://github.com/open-spaced-repetition/fsrs-rs",
13661366
"license": "BSD-3-Clause",

rslib/src/scheduler/fsrs/simulator.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ pub(crate) fn apply_load_balance_and_easy_days(
7575
fn create_review_priority_fn(
7676
review_order: ReviewCardOrder,
7777
deck_size: usize,
78-
params: Vec<f32>,
7978
) -> Option<ReviewPriorityFn> {
8079
// Helper macro to wrap closure in ReviewPriorityFn
8180
macro_rules! wrap {
@@ -86,28 +85,28 @@ fn create_review_priority_fn(
8685

8786
match review_order {
8887
// Ease-based ordering
89-
EaseAscending => wrap!(|c| -(c.difficulty * 100.0) as i32),
90-
EaseDescending => wrap!(|c| (c.difficulty * 100.0) as i32),
88+
EaseAscending => wrap!(|c, _w| -(c.difficulty * 100.0) as i32),
89+
EaseDescending => wrap!(|c, _w| (c.difficulty * 100.0) as i32),
9190

9291
// Interval-based ordering
93-
IntervalsAscending => wrap!(|c| c.interval as i32),
94-
IntervalsDescending => wrap!(|c| -(c.interval as i32)),
92+
IntervalsAscending => wrap!(|c, _w| c.interval as i32),
93+
IntervalsDescending => wrap!(|c, _w| -(c.interval as i32)),
9594
// Retrievability-based ordering
9695
RetrievabilityAscending => {
97-
wrap!(move |c| (c.retrievability(&params) * 1000.0) as i32)
96+
wrap!(move |c, w| (c.retrievability(w) * 1000.0) as i32)
9897
}
9998
RetrievabilityDescending => {
100-
wrap!(move |c| -(c.retrievability(&params) * 1000.0) as i32)
99+
wrap!(move |c, w| -(c.retrievability(w) * 1000.0) as i32)
101100
}
102101

103102
// Due date ordering
104103
Day | DayThenDeck | DeckThenDay => {
105-
wrap!(|c| c.scheduled_due() as i32)
104+
wrap!(|c, _w| c.scheduled_due() as i32)
106105
}
107106

108107
// Random ordering
109108
Random => {
110-
wrap!(move |_| rand::thread_rng().gen_range(0..deck_size) as i32)
109+
wrap!(move |_c, _w| rand::thread_rng().gen_range(0..deck_size) as i32)
111110
}
112111

113112
// Not implemented yet
@@ -197,7 +196,7 @@ impl Collection {
197196
.review_order
198197
.try_into()
199198
.ok()
200-
.and_then(|order| create_review_priority_fn(order, deck_size, req.params.clone()));
199+
.and_then(|order| create_review_priority_fn(order, deck_size));
201200

202201
let config = SimulatorConfig {
203202
deck_size,

0 commit comments

Comments
 (0)