From 2c0b3f7c0a5a5cf34c656544510f5c5a7eebafde Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Wed, 14 Dec 2011 10:27:20 +0900 Subject: [PATCH] more usn fixes --- anki/importing/anki2.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/anki/importing/anki2.py b/anki/importing/anki2.py index 3e89c65ce..a8ce4ecad 100644 --- a/anki/importing/anki2.py +++ b/anki/importing/anki2.py @@ -67,6 +67,7 @@ class Anki2Importer(Importer): # iterate over source collection add = [] dirty = [] + usn = self.dst.usn() for note in self.src.db.execute( "select * from notes"): # turn the db result into a mutable list @@ -84,7 +85,7 @@ class Anki2Importer(Importer): note[2] = lmid note[3] = self._did(note[3]) note[4] = intTime() - note[5] = -1 # usn + note[5] = usn add.append(note) dirty.append(note[0]) # note we have the added note @@ -189,6 +190,7 @@ class Anki2Importer(Importer): cards = [] revlog = [] cnt = 0 + usn = self.dst.usn() aheadBy = self.src.sched.today - self.dst.sched.today for card in self.src.db.execute( "select f.guid, f.mid, c.* from cards c, notes f " @@ -214,6 +216,7 @@ class Anki2Importer(Importer): card[1] = self._notes[guid][0] card[2] = self._did(card[2]) card[4] = intTime() + card[5] = usn # review cards have a due date relative to collection if card[7] == 2: card[8] -= aheadBy