From d74cc2e9b0f8011eab18738eb67dcef4badb78af Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 21 Sep 2020 11:41:54 +1000 Subject: [PATCH] stop is:due gathering learning cards that are not due yet https://forums.ankiweb.net/t/how-to-avoid-rebuilding-filtered-decks-to-skip-learning-cards-steps/3551/ --- rslib/src/search/sqlwriter.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rslib/src/search/sqlwriter.rs b/rslib/src/search/sqlwriter.rs index c57b55081..b754dd8ce 100644 --- a/rslib/src/search/sqlwriter.rs +++ b/rslib/src/search/sqlwriter.rs @@ -11,6 +11,7 @@ use crate::{ notetype::NoteTypeID, text::{matches_wildcard, text_to_re}, text::{normalize_to_nfc, strip_html_preserving_image_filenames, without_combining}, + timestamp::TimestampSecs, }; use std::{borrow::Cow, fmt::Write}; @@ -284,13 +285,13 @@ impl SqlWriter<'_> { self.sql, "( (c.queue in ({rev},{daylrn}) and c.due <= {today}) or - (c.queue = {lrn} and c.due <= {daycutoff}) + (c.queue = {lrn} and c.due <= {learncutoff}) )", rev = CardQueue::Review as i8, daylrn = CardQueue::DayLearn as i8, today = timing.days_elapsed, lrn = CardQueue::Learn as i8, - daycutoff = timing.next_day_at, + learncutoff = TimestampSecs::now().0 + (self.col.learn_ahead_secs() as i64), ), StateKind::UserBuried => write!(self.sql, "c.queue = {}", CardQueue::UserBuried as i8), StateKind::SchedBuried => {