Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/only let FSRS take over short-term schedule when steps are empty #3496

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rslib/src/scheduler/fsrs/retention.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl Collection {
.is_ok()
},
)?
.clamp(0.75, 0.95))
.clamp(0.7, 0.95))
}

pub fn get_optimal_retention_parameters(
Expand Down
15 changes: 12 additions & 3 deletions rslib/src/scheduler/states/learning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ impl LearnState {
} else {
let (minimum, maximum) = ctx.min_and_max_review_intervals(1);
let (interval, short_term) = if let Some(states) = &ctx.fsrs_next_states {
(states.again.interval, states.again.interval < 0.5)
(
states.again.interval,
ctx.steps.is_empty() && states.again.interval < 0.5,
)
} else {
(ctx.graduating_interval_good as f32, false)
};
Expand Down Expand Up @@ -91,7 +94,10 @@ impl LearnState {
} else {
let (minimum, maximum) = ctx.min_and_max_review_intervals(1);
let (interval, short_term) = if let Some(states) = &ctx.fsrs_next_states {
(states.hard.interval, states.hard.interval < 0.5)
(
states.hard.interval,
ctx.steps.is_empty() && states.hard.interval < 0.5,
)
} else {
(ctx.graduating_interval_good as f32, false)
};
Expand Down Expand Up @@ -133,7 +139,10 @@ impl LearnState {
} else {
let (minimum, maximum) = ctx.min_and_max_review_intervals(1);
let (interval, short_term) = if let Some(states) = &ctx.fsrs_next_states {
(states.good.interval, states.good.interval < 0.5)
(
states.good.interval,
ctx.steps.is_empty() && states.good.interval < 0.5,
)
} else {
(ctx.graduating_interval_good as f32, false)
};
Expand Down
18 changes: 9 additions & 9 deletions rslib/src/scheduler/states/relearning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ impl RelearnState {
},
review: again_review,
};
if interval > 0.5 {
again_review.into()
} else {
if ctx.relearn_steps.is_empty() && interval < 0.5 {
again_relearn.into()
} else {
again_review.into()
}
} else {
self.review.into()
Expand Down Expand Up @@ -112,10 +112,10 @@ impl RelearnState {
},
review: hard_review,
};
if interval > 0.5 {
hard_review.into()
} else {
if ctx.relearn_steps.is_empty() && interval < 0.5 {
hard_relearn.into()
} else {
hard_review.into()
}
} else {
self.review.into()
Expand Down Expand Up @@ -162,10 +162,10 @@ impl RelearnState {
},
review: good_review,
};
if interval > 0.5 {
good_review.into()
} else {
if ctx.relearn_steps.is_empty() && interval < 0.5 {
good_relearn.into()
} else {
good_review.into()
}
} else {
self.review.into()
Expand Down
2 changes: 1 addition & 1 deletion rslib/src/scheduler/states/review.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ impl ReviewState {
review: again_review,
}
.into()
} else if scheduled_days < 0.5 {
} else if ctx.relearn_steps.is_empty() && scheduled_days < 0.5 {
again_relearn.into()
} else {
again_review.into()
Expand Down
4 changes: 4 additions & 0 deletions rslib/src/scheduler/states/steps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ impl<'a> LearningSteps<'a> {
pub(crate) fn remaining_for_failed(self) -> u32 {
self.steps.len() as u32
}

pub(crate) fn is_empty(&self) -> bool {
self.steps.is_empty()
}
}

/// If the given interval in seconds surpasses 1 day, rounds it to a whole
Expand Down