Fix change notetype affecting cards outside selection

Accidentally introduced by the search refactoring in #1600, this lead
to a query that matched items outside of the selected notes, eg

(n.id in (1506029488152) and c.ord = 43 or c.ord = 4)

Closes #1727
This commit is contained in:
Damien Elmes 2022-03-20 15:36:54 +10:00
parent d100f7a2c8
commit e2eff7deae

View File

@ -314,13 +314,13 @@ impl Collection {
usn: Usn,
) -> Result<(), AnkiError> {
if !map.remapped.is_empty() {
let mut ords = SearchBuilder::any(
let ords = SearchBuilder::any(
map.remapped
.keys()
.map(|o| TemplateKind::Ordinal(*o as u16)),
);
self.search_cards_into_table(
SearchBuilder::from(nids).and_join(&mut ords),
SearchBuilder::from(nids).and_join(&mut ords.group()),
SortMode::NoOrder,
)?;
for mut card in self.storage.all_searched_cards()? {