mirror of
https://github.com/ankitects/anki.git
synced 2025-09-21 07:22:23 -04:00
log actual changes, not all prospectives
This commit is contained in:
parent
a52e740ef6
commit
c1ea82273b
2 changed files with 7 additions and 1 deletions
|
@ -93,3 +93,7 @@ class DB(object):
|
||||||
|
|
||||||
def __exit__(self, exc_type, *args):
|
def __exit__(self, exc_type, *args):
|
||||||
self._db.close()
|
self._db.close()
|
||||||
|
|
||||||
|
def totalChanges(self):
|
||||||
|
return self._db.total_changes
|
||||||
|
|
||||||
|
|
|
@ -151,7 +151,7 @@ class NoteImporter(Importer):
|
||||||
self.updateCards()
|
self.updateCards()
|
||||||
# make sure to update sflds, etc
|
# make sure to update sflds, etc
|
||||||
self.log.append(_("%(a)d notes added, %(b)d notes updated.") %
|
self.log.append(_("%(a)d notes added, %(b)d notes updated.") %
|
||||||
dict(a=len(new), b=len(updates)))
|
dict(a=len(new), b=self.updateCount))
|
||||||
self.total = len(self._ids)
|
self.total = len(self._ids)
|
||||||
|
|
||||||
def newData(self, n):
|
def newData(self, n):
|
||||||
|
@ -186,9 +186,11 @@ class NoteImporter(Importer):
|
||||||
id, n.fieldsStr, tags]
|
id, n.fieldsStr, tags]
|
||||||
|
|
||||||
def addUpdates(self, rows):
|
def addUpdates(self, rows):
|
||||||
|
old = self.col.db.totalChanges()
|
||||||
self.col.db.executemany("""
|
self.col.db.executemany("""
|
||||||
update notes set mod = ?, usn = ?, flds = ?, tags = ?
|
update notes set mod = ?, usn = ?, flds = ?, tags = ?
|
||||||
where id = ? and (flds != ? or tags != ?)""", rows)
|
where id = ? and (flds != ? or tags != ?)""", rows)
|
||||||
|
self.updateCount = self.col.db.totalChanges() - old
|
||||||
|
|
||||||
def processFields(self, note, fields=None):
|
def processFields(self, note, fields=None):
|
||||||
if not fields:
|
if not fields:
|
||||||
|
|
Loading…
Reference in a new issue