diff --git a/qt/aqt/operations/deck.py b/qt/aqt/operations/deck.py index 5c2300f3e..c526a016b 100644 --- a/qt/aqt/operations/deck.py +++ b/qt/aqt/operations/deck.py @@ -32,12 +32,13 @@ def remove_decks( def reparent_decks( *, parent: QWidget, deck_ids: Sequence[DeckId], new_parent: DeckId ) -> CollectionOp[OpChangesWithCount]: + def on_success(out): + if out.count > 0: + tooltip(tr.browsing_reparented_decks(count=out.count), parent=parent) + return CollectionOp( parent, lambda col: col.decks.reparent(deck_ids=deck_ids, new_parent=new_parent) - ).success( - lambda out: out.count > 0 - and tooltip(tr.browsing_reparented_decks(count=out.count), parent=parent) - ) + ).success(on_success) def rename_deck( diff --git a/rslib/src/decks/reparent.rs b/rslib/src/decks/reparent.rs index a30b1a181..59f6baa08 100644 --- a/rslib/src/decks/reparent.rs +++ b/rslib/src/decks/reparent.rs @@ -36,14 +36,17 @@ impl Collection { for deck in deck_ids { if let Some(mut deck) = self.storage.get_deck(*deck)? { if let Some(new_name) = deck.name.reparented_name(target_name.as_ref()) { - let parent_decks = self.storage.parent_decks(&deck).unwrap(); match target_deck { - Some(ref target) => if parent_decks.contains(&target) { - continue; + Some(ref target) => { + if parent_decks.contains(target) { + continue; + } } - None => if parent_decks.is_empty() { - continue; + None => { + if parent_decks.is_empty() { + continue; + } } }