From 38b36323da4e658b9b2e517b79d6cfe192219779 Mon Sep 17 00:00:00 2001 From: Timothy Rae Date: Tue, 16 Feb 2016 12:26:52 +0900 Subject: [PATCH] Don't use default deck when deck override set to invalid deck When the override deck is not valid, the more intuitive behavior for users is to not override. Advanced users that really want to use this feature will immediately open the deck override settings and see that it's referencing an invalid deck. Advanced users and developers have all been stumped by the old behavior, it's simply not intuitive. --- anki/collection.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/anki/collection.py b/anki/collection.py index a6abe04b6..d6692e5af 100644 --- a/anki/collection.py +++ b/anki/collection.py @@ -379,7 +379,11 @@ insert into cards values (?,?,?,?,?,?,0,0,?,0,0,0,0,0,0,0,0,"")""", card = anki.cards.Card(self) card.nid = note.id card.ord = template['ord'] - card.did = template['did'] or note.model()['did'] + # Use template did (deck override) if valid, otherwise model did + if template['did'] and template['did'] in self.decks.decks: + card.did = template['did'] + else: + card.did = note.model()['did'] # if invalid did, use default instead deck = self.decks.get(card.did) if deck['dyn']: