Fix/Reschedule doesn't work on cards in filtered deck (#3441)

* Fix/Reschedule doesn't work on cards in filtered deck

* Update docstring (dae)
This commit is contained in:
Jarrett Ye 2024-10-02 16:09:25 +08:00 committed by GitHub
parent d6aa95950d
commit 159681d9f2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 3 deletions

View file

@ -61,10 +61,11 @@ pub enum SearchNode {
EditedInDays(u32),
CardTemplate(TemplateKind),
Deck(String),
/// Matches cards in a list of decks (original_deck_id is not checked).
/// Matches cards in a list of deck ids. Cards are matched even if they are
/// in a filtered deck.
DeckIdsWithoutChildren(String),
/// Matches cards in a deck or its children (original_deck_id is not
/// checked).
/// checked, so filtered cards are not matched).
DeckIdWithChildren(DeckId),
IntroducedInDays(u32),
NotetypeId(NotetypeId),

View file

@ -161,7 +161,12 @@ impl SqlWriter<'_> {
write!(self.sql, "n.mid = {}", ntid).unwrap();
}
SearchNode::DeckIdsWithoutChildren(dids) => {
write!(self.sql, "c.did in ({})", dids).unwrap();
write!(
self.sql,
"c.did in ({}) or (c.odid != 0 and c.odid in ({}))",
dids, dids
)
.unwrap();
}
SearchNode::DeckIdWithChildren(did) => self.write_deck_id_with_children(*did)?,
SearchNode::Notetype(notetype) => self.write_notetype(&norm(notetype)),