This commit is contained in:
user1823 2025-10-29 21:08:17 +03:00 committed by GitHub
commit 9cfa8c580d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 16 additions and 5 deletions

View file

@ -836,9 +836,17 @@ impl fmt::Display for ReviewOrderSubclause {
let today = timing.days_elapsed; let today = timing.days_elapsed;
let next_day_at = timing.next_day_at.0; let next_day_at = timing.next_day_at.0;
let now = timing.now.0; let now = timing.now.0;
temp_string = if *order == SqlSortOrder::Ascending {
format!("extract_fsrs_relative_retrievability(data, case when odue !=0 then odue else due end, {today}, ivl, {next_day_at}, {now}) {order}"); // Use relative retrievability to give higher priority to high DR cards,
&temp_string // while selecting the most overdue ones first
temp_string =
format!("extract_fsrs_relative_retrievability(data, case when odue !=0 then odue else due end, {today}, ivl, {next_day_at}, {now}) asc");
&temp_string
} else {
temp_string =
format!("extract_fsrs_retrievability(data, case when odue !=0 then odue else due end, ivl, {today}, {next_day_at}, {now}) desc");
&temp_string
}
} }
ReviewOrderSubclause::Added => "nid asc, ord asc", ReviewOrderSubclause::Added => "nid asc, ord asc",
ReviewOrderSubclause::ReverseAdded => "nid desc, ord asc", ReviewOrderSubclause::ReverseAdded => "nid desc, ord asc",

View file

@ -651,7 +651,7 @@ impl SqliteStorage {
} }
} }
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy, PartialEq)]
pub enum SqlSortOrder { pub enum SqlSortOrder {
Ascending, Ascending,
Descending, Descending,
@ -677,7 +677,10 @@ mod test {
use crate::storage::card::ReviewOrderSubclause; use crate::storage::card::ReviewOrderSubclause;
#[test] #[test]
fn missing_memory_state_falls_back_to_sm2() -> Result<()> { // Ascending R uses relative R, which can be approximated using ivl
// and elapsed days.
// Descending R uses pure R, which can't be approximated.
fn missing_memory_state_falls_back_to_sm2_for_asc_r() -> Result<()> {
let (mut col, _cids) = v3_test_collection(1)?; let (mut col, _cids) = v3_test_collection(1)?;
col.set_config_bool(BoolKey::Fsrs, true, true)?; col.set_config_bool(BoolKey::Fsrs, true, true)?;
col.answer_easy(); col.answer_easy();