Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions rslib/src/search/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,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