mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 23:12:21 -04:00
split empty card removal into separate report
This commit is contained in:
parent
fe0e227325
commit
a3407020cb
2 changed files with 14 additions and 6 deletions
|
@ -400,11 +400,20 @@ select id from notes where id in %s and id not in (select nid from cards)""" %
|
||||||
ids2str(nids))
|
ids2str(nids))
|
||||||
self._remNotes(nids)
|
self._remNotes(nids)
|
||||||
|
|
||||||
def remEmptyCards(self, ids):
|
def emptyCids(self):
|
||||||
if not ids:
|
rem = []
|
||||||
return
|
for m in self.models.all():
|
||||||
if runFilter("remEmptyCards", True, len(ids)):
|
rem += self.genCards(self.models.nids(m))
|
||||||
self.remCards(ids)
|
return rem
|
||||||
|
|
||||||
|
def emptyCardReport(self, cids):
|
||||||
|
rep = ""
|
||||||
|
for ords, flds in self.db.all("""
|
||||||
|
select group_concat(ord+1), flds from cards c, notes n
|
||||||
|
where c.nid = n.id and c.id in %s group by nid""" % ids2str(cids)):
|
||||||
|
rep += "Cards: %s\nFields: %s\n\n" % (
|
||||||
|
ords, flds.replace("\x1f", " / "))
|
||||||
|
return rep
|
||||||
|
|
||||||
# Field checksums and sorting fields
|
# Field checksums and sorting fields
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
|
@ -362,7 +362,6 @@ select id from notes where mid = ?)""" % " ".join(map),
|
||||||
|
|
||||||
def _syncTemplates(self, m):
|
def _syncTemplates(self, m):
|
||||||
rem = self.col.genCards(self.nids(m))
|
rem = self.col.genCards(self.nids(m))
|
||||||
self.col.remEmptyCards(rem)
|
|
||||||
|
|
||||||
# Model changing
|
# Model changing
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
Loading…
Reference in a new issue