From df319c7c5892910713ec94195cc296a12a9e4504 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Thu, 9 Jul 2020 11:07:50 +1000 Subject: [PATCH] is:review should include relearning cards https://forums.ankiweb.net/t/anki-2-1-28-beta/629/36 This issue appears to have existed since the V2 scheduler was introduced - the old Python search code was ignoring Relearn as well. --- rslib/src/search/sqlwriter.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/rslib/src/search/sqlwriter.rs b/rslib/src/search/sqlwriter.rs index 06b726b25..b145c4635 100644 --- a/rslib/src/search/sqlwriter.rs +++ b/rslib/src/search/sqlwriter.rs @@ -3,7 +3,7 @@ use super::parser::{Node, PropertyKind, SearchNode, StateKind, TemplateKind}; use crate::{ - card::CardQueue, + card::{CardQueue, CardType}, collection::Collection, decks::human_deck_name_to_native, err::Result, @@ -259,8 +259,13 @@ impl SqlWriter<'_> { fn write_state(&mut self, state: &StateKind) -> Result<()> { let timing = self.col.timing_today()?; match state { - StateKind::New => write!(self.sql, "c.type = {}", CardQueue::New as i8), - StateKind::Review => write!(self.sql, "c.type = {}", CardQueue::Review as i8), + StateKind::New => write!(self.sql, "c.type = {}", CardType::New as i8), + StateKind::Review => write!( + self.sql, + "c.type in ({}, {})", + CardType::Review as i8, + CardType::Relearn as i8, + ), StateKind::Learning => write!( self.sql, "c.queue in ({},{})", @@ -707,7 +712,7 @@ mod test { ); assert_eq!( s(ctx, "is:new").0, - format!("(c.type = {})", CardQueue::New as i8) + format!("(c.type = {})", CardType::New as i8) ); // rated