mirror of
https://github.com/ankitects/anki.git
synced 2025-11-10 14:47:12 -05:00
vacuum after import; make sure models.current() always returns
This commit is contained in:
parent
1772474765
commit
b31bd5c091
2 changed files with 5 additions and 1 deletions
|
|
@ -41,6 +41,8 @@ class Anki2Importer(Importer):
|
||||||
self._importFacts()
|
self._importFacts()
|
||||||
self._importCards()
|
self._importCards()
|
||||||
self._importMedia()
|
self._importMedia()
|
||||||
|
self.dst.db.execute("vacuum")
|
||||||
|
self.dst.db.execute("analyze")
|
||||||
|
|
||||||
# Facts
|
# Facts
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,9 @@ class ModelManager(object):
|
||||||
def current(self):
|
def current(self):
|
||||||
"Get current model."
|
"Get current model."
|
||||||
try:
|
try:
|
||||||
return self.get(self.deck.groups.top()['curModel'])
|
m = self.get(self.deck.groups.top()['curModel'])
|
||||||
|
assert m
|
||||||
|
return m
|
||||||
except:
|
except:
|
||||||
return self.models.values()[0]
|
return self.models.values()[0]
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue