mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
Fix/missing-simulator-decay-for-FSRS-5 (#3956)
This commit is contained in:
parent
6d0e52e8a0
commit
90f2e06b17
4 changed files with 15 additions and 17 deletions
5
Cargo.lock
generated
5
Cargo.lock
generated
|
@ -2099,9 +2099,8 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fsrs"
|
name = "fsrs"
|
||||||
version = "3.0.0"
|
version = "4.0.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/open-spaced-repetition/fsrs-rs.git?rev=2fb2ac7f7a4d14d07663fe5698ba5e95e3f78ebd#2fb2ac7f7a4d14d07663fe5698ba5e95e3f78ebd"
|
||||||
checksum = "e7e39017be91629761c3a2802032eb38d226227e1a21433381da4310612199ee"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"burn",
|
"burn",
|
||||||
"itertools 0.14.0",
|
"itertools 0.14.0",
|
||||||
|
|
|
@ -35,9 +35,9 @@ git = "https://github.com/ankitects/linkcheck.git"
|
||||||
rev = "184b2ca50ed39ca43da13f0b830a463861adb9ca"
|
rev = "184b2ca50ed39ca43da13f0b830a463861adb9ca"
|
||||||
|
|
||||||
[workspace.dependencies.fsrs]
|
[workspace.dependencies.fsrs]
|
||||||
version = "3.0.0"
|
# version = "3.0.0"
|
||||||
# git = "https://github.com/open-spaced-repetition/fsrs-rs.git"
|
git = "https://github.com/open-spaced-repetition/fsrs-rs.git"
|
||||||
# rev = "c7717682997a8a6d53d97c7196281e745c5b3c8e"
|
rev = "2fb2ac7f7a4d14d07663fe5698ba5e95e3f78ebd"
|
||||||
# path = "../open-spaced-repetition/fsrs-rs"
|
# path = "../open-spaced-repetition/fsrs-rs"
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
|
|
|
@ -1360,7 +1360,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "fsrs",
|
"name": "fsrs",
|
||||||
"version": "3.0.0",
|
"version": "4.0.0",
|
||||||
"authors": "Open Spaced Repetition",
|
"authors": "Open Spaced Repetition",
|
||||||
"repository": "https://github.com/open-spaced-repetition/fsrs-rs",
|
"repository": "https://github.com/open-spaced-repetition/fsrs-rs",
|
||||||
"license": "BSD-3-Clause",
|
"license": "BSD-3-Clause",
|
||||||
|
|
|
@ -75,7 +75,6 @@ pub(crate) fn apply_load_balance_and_easy_days(
|
||||||
fn create_review_priority_fn(
|
fn create_review_priority_fn(
|
||||||
review_order: ReviewCardOrder,
|
review_order: ReviewCardOrder,
|
||||||
deck_size: usize,
|
deck_size: usize,
|
||||||
params: Vec<f32>,
|
|
||||||
) -> Option<ReviewPriorityFn> {
|
) -> Option<ReviewPriorityFn> {
|
||||||
// Helper macro to wrap closure in ReviewPriorityFn
|
// Helper macro to wrap closure in ReviewPriorityFn
|
||||||
macro_rules! wrap {
|
macro_rules! wrap {
|
||||||
|
@ -86,28 +85,28 @@ fn create_review_priority_fn(
|
||||||
|
|
||||||
match review_order {
|
match review_order {
|
||||||
// Ease-based ordering
|
// Ease-based ordering
|
||||||
EaseAscending => wrap!(|c| -(c.difficulty * 100.0) as i32),
|
EaseAscending => wrap!(|c, _w| -(c.difficulty * 100.0) as i32),
|
||||||
EaseDescending => wrap!(|c| (c.difficulty * 100.0) as i32),
|
EaseDescending => wrap!(|c, _w| (c.difficulty * 100.0) as i32),
|
||||||
|
|
||||||
// Interval-based ordering
|
// Interval-based ordering
|
||||||
IntervalsAscending => wrap!(|c| c.interval as i32),
|
IntervalsAscending => wrap!(|c, _w| c.interval as i32),
|
||||||
IntervalsDescending => wrap!(|c| -(c.interval as i32)),
|
IntervalsDescending => wrap!(|c, _w| -(c.interval as i32)),
|
||||||
// Retrievability-based ordering
|
// Retrievability-based ordering
|
||||||
RetrievabilityAscending => {
|
RetrievabilityAscending => {
|
||||||
wrap!(move |c| (c.retrievability(¶ms) * 1000.0) as i32)
|
wrap!(move |c, w| (c.retrievability(w) * 1000.0) as i32)
|
||||||
}
|
}
|
||||||
RetrievabilityDescending => {
|
RetrievabilityDescending => {
|
||||||
wrap!(move |c| -(c.retrievability(¶ms) * 1000.0) as i32)
|
wrap!(move |c, w| -(c.retrievability(w) * 1000.0) as i32)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Due date ordering
|
// Due date ordering
|
||||||
Day | DayThenDeck | DeckThenDay => {
|
Day | DayThenDeck | DeckThenDay => {
|
||||||
wrap!(|c| c.scheduled_due() as i32)
|
wrap!(|c, _w| c.scheduled_due() as i32)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Random ordering
|
// Random ordering
|
||||||
Random => {
|
Random => {
|
||||||
wrap!(move |_| rand::thread_rng().gen_range(0..deck_size) as i32)
|
wrap!(move |_c, _w| rand::thread_rng().gen_range(0..deck_size) as i32)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not implemented yet
|
// Not implemented yet
|
||||||
|
@ -197,7 +196,7 @@ impl Collection {
|
||||||
.review_order
|
.review_order
|
||||||
.try_into()
|
.try_into()
|
||||||
.ok()
|
.ok()
|
||||||
.and_then(|order| create_review_priority_fn(order, deck_size, req.params.clone()));
|
.and_then(|order| create_review_priority_fn(order, deck_size));
|
||||||
|
|
||||||
let config = SimulatorConfig {
|
let config = SimulatorConfig {
|
||||||
deck_size,
|
deck_size,
|
||||||
|
|
Loading…
Reference in a new issue