More accurate sorting by R (#3747)

* Match calc of relative overdueness in SM2 and FSRS

* Fix calculation of FSRS relative overdueness

* Improve readability by avoiding double negative

* Move comment line
This commit is contained in:
user1823 2025-01-25 15:45:49 +05:30 committed by GitHub
parent 9b2987b4a8
commit b80384c715
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 2 deletions

View file

@ -775,7 +775,8 @@ impl fmt::Display for ReviewOrderSubclause {
ReviewOrderSubclause::DifficultyDescending => "extract_fsrs_variable(data, 'd') desc",
ReviewOrderSubclause::RetrievabilitySm2 { today, order } => {
temp_string = format!(
"ivl / cast({today}-due+0.001 as real) {order}",
// - (elapsed days+0.001)/(scheduled interval)
"-(1 + cast({today}-due+0.001 as real)/ivl) {order}",
today = today
);
&temp_string

View file

@ -388,7 +388,9 @@ fn add_extract_fsrs_relative_retrievability(db: &Connection) -> rusqlite::Result
.max(0.0001);
Ok(Some(
-(1. / current_retrievability - 1.) / (1. / desired_retrievability - 1.),
// power should be the reciprocal of the value of DECAY in FSRS-rs, which is
// currently -0.5
-(current_retrievability.powi(-2) - 1.) / (desired_retrievability.powi(-2) - 1.),
))
},
)