mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
catch missing nids in fixIntegrity()
This commit is contained in:
parent
322a2884f9
commit
b226675618
1 changed files with 9 additions and 0 deletions
|
@ -668,6 +668,15 @@ select id from notes where id not in (select distinct nid from cards)""")
|
||||||
ngettext("Deleted %d note with no cards.",
|
ngettext("Deleted %d note with no cards.",
|
||||||
"Deleted %d notes with no cards.", cnt) % cnt)
|
"Deleted %d notes with no cards.", cnt) % cnt)
|
||||||
self._remNotes(ids)
|
self._remNotes(ids)
|
||||||
|
# cards with missing notes
|
||||||
|
ids = self.db.list("""
|
||||||
|
select id from cards where nid not in (select id from notes)""")
|
||||||
|
if ids:
|
||||||
|
cnt = len(ids)
|
||||||
|
problems.append(
|
||||||
|
ngettext("Deleted %d card with missing note.",
|
||||||
|
"Deleted %d cards with missing note.", cnt) % cnt)
|
||||||
|
self.remCards(ids)
|
||||||
# tags
|
# tags
|
||||||
self.tags.registerNotes()
|
self.tags.registerNotes()
|
||||||
# field cache
|
# field cache
|
||||||
|
|
Loading…
Reference in a new issue