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.
This commit is contained in:
Damien Elmes 2020-07-09 11:07:50 +10:00
parent c50fa2c787
commit df319c7c58

View file

@ -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