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._ids = []
|
||||||
self._cards = []
|
self._cards = []
|
||||||
self._emptyNotes = False
|
self._emptyNotes = False
|
||||||
|
dupeCount = 0
|
||||||
for n in notes:
|
for n in notes:
|
||||||
if not self.allowHTML:
|
if not self.allowHTML:
|
||||||
for c in range(len(n.fields)):
|
for c in range(len(n.fields)):
|
||||||
|
@ -151,8 +152,11 @@ class NoteImporter(Importer):
|
||||||
if data:
|
if data:
|
||||||
updates.append(data)
|
updates.append(data)
|
||||||
updateLog.append(updateLogTxt % fld0)
|
updateLog.append(updateLogTxt % fld0)
|
||||||
|
dupeCount += 1
|
||||||
found = True
|
found = True
|
||||||
break
|
break
|
||||||
|
elif self.importMode == 1:
|
||||||
|
dupeCount += 1
|
||||||
elif self.importMode == 2:
|
elif self.importMode == 2:
|
||||||
# allow duplicates in this case
|
# allow duplicates in this case
|
||||||
updateLog.append(dupeLogTxt % fld0)
|
updateLog.append(dupeLogTxt % fld0)
|
||||||
|
@ -183,9 +187,19 @@ class NoteImporter(Importer):
|
||||||
self.col.sched.randomizeCards(did)
|
self.col.sched.randomizeCards(did)
|
||||||
else:
|
else:
|
||||||
self.col.sched.orderCards(did)
|
self.col.sched.orderCards(did)
|
||||||
|
|
||||||
part1 = ngettext("%d note added", "%d notes added", len(new)) % len(new)
|
part1 = ngettext("%d note added", "%d notes added", len(new)) % len(new)
|
||||||
part2 = ngettext("%d note updated", "%d notes updated", self.updateCount) % self.updateCount
|
part2 = ngettext("%d note updated", "%d notes updated",
|
||||||
self.log.append("%s, %s." % (part1, part2))
|
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)
|
self.log.extend(updateLog)
|
||||||
if self._emptyNotes:
|
if self._emptyNotes:
|
||||||
self.log.append(_("""\
|
self.log.append(_("""\
|
||||||
|
@ -213,7 +227,6 @@ content in the text file to the correct fields."""))
|
||||||
"insert or replace into notes values (?,?,?,?,?,?,?,?,?,?,?)",
|
"insert or replace into notes values (?,?,?,?,?,?,?,?,?,?,?)",
|
||||||
rows)
|
rows)
|
||||||
|
|
||||||
# need to document that deck is ignored in this case
|
|
||||||
def updateData(self, n, id, sflds):
|
def updateData(self, n, id, sflds):
|
||||||
self._ids.append(id)
|
self._ids.append(id)
|
||||||
if not self.processFields(n, sflds):
|
if not self.processFields(n, sflds):
|
||||||
|
|
Loading…
Reference in a new issue