mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
add unchanged count to import log
This commit is contained in:
parent
4de023ecba
commit
8620b81817
1 changed files with 16 additions and 3 deletions
|
@ -117,6 +117,7 @@ class NoteImporter(Importer):
|
|||
self._ids = []
|
||||
self._cards = []
|
||||
self._emptyNotes = False
|
||||
dupeCount = 0
|
||||
for n in notes:
|
||||
if not self.allowHTML:
|
||||
for c in range(len(n.fields)):
|
||||
|
@ -151,8 +152,11 @@ class NoteImporter(Importer):
|
|||
if data:
|
||||
updates.append(data)
|
||||
updateLog.append(updateLogTxt % fld0)
|
||||
dupeCount += 1
|
||||
found = True
|
||||
break
|
||||
elif self.importMode == 1:
|
||||
dupeCount += 1
|
||||
elif self.importMode == 2:
|
||||
# allow duplicates in this case
|
||||
updateLog.append(dupeLogTxt % fld0)
|
||||
|
@ -183,9 +187,19 @@ class NoteImporter(Importer):
|
|||
self.col.sched.randomizeCards(did)
|
||||
else:
|
||||
self.col.sched.orderCards(did)
|
||||
|
||||
part1 = ngettext("%d note added", "%d notes added", len(new)) % len(new)
|
||||
part2 = ngettext("%d note updated", "%d notes updated", self.updateCount) % self.updateCount
|
||||
self.log.append("%s, %s." % (part1, part2))
|
||||
part2 = ngettext("%d note updated", "%d notes updated",
|
||||
self.updateCount) % self.updateCount
|
||||
if self.importMode == 0:
|
||||
unchanged = dupeCount - self.updateCount
|
||||
elif self.importMode == 1:
|
||||
unchanged = dupeCount
|
||||
else:
|
||||
unchanged = 0
|
||||
part3 = ngettext("%d note unchanged", "%d notes unchanged",
|
||||
unchanged) % unchanged
|
||||
self.log.append("%s, %s, %s." % (part1, part2, part3))
|
||||
self.log.extend(updateLog)
|
||||
if self._emptyNotes:
|
||||
self.log.append(_("""\
|
||||
|
@ -213,7 +227,6 @@ content in the text file to the correct fields."""))
|
|||
"insert or replace into notes values (?,?,?,?,?,?,?,?,?,?,?)",
|
||||
rows)
|
||||
|
||||
# need to document that deck is ignored in this case
|
||||
def updateData(self, n, id, sflds):
|
||||
self._ids.append(id)
|
||||
if not self.processFields(n, sflds):
|
||||
|
|
Loading…
Reference in a new issue