diff --git a/anki/deck.py b/anki/deck.py index 10c82b85f..29f6e3384 100644 --- a/anki/deck.py +++ b/anki/deck.py @@ -1542,6 +1542,9 @@ facts.modelId = :id""", id=modelId)) insert into cardTags (cardId, tagId, src) values (:cardId, :tagId, :src)""", d) + self.s.statement(""" +delete from tags where id not in (select distinct tagId from cardTags) +""") def updateTagsForModel(self, model): cardIds = self.s.column0("""