Skip to content

Commit

Permalink
Fix/Reschedule doesn't work on cards in filtered deck (#3441)
Browse files Browse the repository at this point in the history
* Fix/Reschedule doesn't work on cards in filtered deck

* Update docstring (dae)
  • Loading branch information
L-M-Sherlock authored Oct 2, 2024
1 parent d6aa959 commit 159681d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 3 additions & 2 deletions rslib/src/search/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
7 changes: 6 additions & 1 deletion rslib/src/search/sqlwriter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down

0 comments on commit 159681d

Please sign in to comment.