diff --git a/anki/collection.py b/anki/collection.py index a49457192..ef84f3df8 100644 --- a/anki/collection.py +++ b/anki/collection.py @@ -177,20 +177,6 @@ crt=?, mod=?, scm=?, dty=?, usn=?, ls=?, conf=?""", self.sched.onClose() self.dty = False - def rename(self, path): - raise "nyi" - # close our DB connection - self.close() - # move to new path - shutil.copy2(self.path, path) - os.unlink(self.path) - # record old dir - olddir = self.media.dir() - # reconnect & move media - self.path = path - self.reopen() - self.media.move(olddir) - def usn(self): return self._usn if self.server else -1 diff --git a/anki/importing/anki2.py b/anki/importing/anki2.py index 01d04d45c..616a1d167 100644 --- a/anki/importing/anki2.py +++ b/anki/importing/anki2.py @@ -90,7 +90,8 @@ class Anki2Importer(Importer): # note we have the added note self._notes[guid] = (note[0], note[4], note[2]) else: - print "merging notes nyi" + # not yet implemented + pass # add to col self.dst.db.executemany( "insert or replace into notes values (?,?,?,?,?,?,?,?,?,?,?,?)", @@ -183,6 +184,7 @@ class Anki2Importer(Importer): cards = [] revlog = [] cnt = 0 + 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 " "where c.nid = f.id"): @@ -207,6 +209,9 @@ class Anki2Importer(Importer): card[1] = self._notes[guid][0] card[2] = self._did(card[2]) card[4] = intTime() + # review cards have a due date relative to collection + if card[7] == 2: + card[8] -= aheadBy cards.append(card) # we need to import revlog, rewriting card ids for rev in self.src.db.execute( diff --git a/anki/upgrade.py b/anki/upgrade.py index 2bc81e311..4db4bfe35 100644 --- a/anki/upgrade.py +++ b/anki/upgrade.py @@ -628,7 +628,6 @@ update cards set due = cast( col.conf['nextPos'] = ( col.db.scalar("select max(id) from notes") or 0)+1 col.save() - # optimize and finish col.db.commit() col.db.execute("vacuum")