unbury on open/close and make sure we set usn when unburying

This commit is contained in:
Damien Elmes 2013-09-04 04:38:00 +09:00
parent 492ed33f4d
commit 0bef1d8530
2 changed files with 8 additions and 2 deletions

View File

@ -58,7 +58,9 @@ class _Collection(object):
self.crt = int(time.mktime(d.timetuple()))
self.sched = Scheduler(self)
if not self.conf.get("newBury", False):
mod = self.db.mod
self.sched.unburyCards()
self.db.mod = mod
def name(self):
n = os.path.splitext(os.path.basename(self.path))[0]
@ -131,6 +133,10 @@ crt=?, mod=?, scm=?, dty=?, usn=?, ls=?, conf=?""",
def close(self, save=True):
"Disconnect from DB."
if self.db:
if not self.conf.get("newBury", False):
mod = self.db.mod
self.sched.unburyCards()
self.db.mod = mod
if save:
self.save()
else:

View File

@ -135,9 +135,9 @@ order by due""" % self._deckLimit(),
def unburyCards(self):
"Unbury cards."
self.col.conf['lastUnburied'] = self.today
self.col.setMod()
self.col.db.execute(
"update cards set queue = type where queue = -2")
"update cards set mod=?,usn=?,queue=type where queue = -2",
intTime(), self.col.usn())
# Rev/lrn/time daily stats
##########################################################################