From 8ed1fa7e995d9951489d6c4c2d5b3197dc42fd3c Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Fri, 24 Dec 2021 12:24:45 +1000 Subject: [PATCH] fix interday learning cards not being buried https://forums.ankiweb.net/t/2-1-49-mac-automatic-unbury-still-not-working/14799/43 --- rslib/src/storage/card/mod.rs | 19 +++++++++++-------- rslib/src/storage/card/siblings_for_bury.sql | 12 ++++++------ 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/rslib/src/storage/card/mod.rs b/rslib/src/storage/card/mod.rs index 21f7d47cc..ce9318082 100644 --- a/rslib/src/storage/card/mod.rs +++ b/rslib/src/storage/card/mod.rs @@ -396,16 +396,19 @@ impl super::SqliteStorage { include_reviews: bool, ) -> Result<()> { self.setup_searched_cards_table()?; + let params = named_params! { + ":card_id": cid, + ":note_id": nid, + ":include_new": include_new, + ":include_reviews": include_reviews, + ":new_queue": CardQueue::New as i8, + ":review_queue": CardQueue::Review as i8, + ":daylearn_queue": CardQueue::DayLearn as i8, + } + .to_vec(); self.db .prepare_cached(include_str!("siblings_for_bury.sql"))? - .execute(params![ - cid, - nid, - include_new, - CardQueue::New as i8, - include_reviews, - CardQueue::Review as i8 - ])?; + .execute(&*params)?; Ok(()) } diff --git a/rslib/src/storage/card/siblings_for_bury.sql b/rslib/src/storage/card/siblings_for_bury.sql index 4f8ad09e4..3bc274376 100644 --- a/rslib/src/storage/card/siblings_for_bury.sql +++ b/rslib/src/storage/card/siblings_for_bury.sql @@ -1,15 +1,15 @@ INSERT INTO search_cids SELECT id FROM cards -WHERE id != ? - AND nid = ? +WHERE id != :card_id + AND nid = :note_id AND ( ( - ? - AND queue = ? + :include_new + AND queue = :new_queue ) OR ( - ? - AND queue = ? + :include_reviews + AND queue in (:review_queue, :daylearn_queue) ) ); \ No newline at end of file