From 29a680d8bf7d44ee250ccf9f47ade36f47d17b5c Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 5 Feb 2019 12:30:22 +1000 Subject: [PATCH] fix decimal intervals in revlog as well --- anki/collection.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/anki/collection.py b/anki/collection.py index caa1adff5..5a993c1d3 100644 --- a/anki/collection.py +++ b/anki/collection.py @@ -852,12 +852,14 @@ and type = 0""", intTime(), self.usn()) % ids2str(ids), self.sched.today, intTime(), self.usn()) # v2 sched had a bug that could create decimal intervals curs = self.db.cursor() - curs.execute("update cards set ivl=round(ivl) where ivl!=round(ivl)") + + curs.execute("update cards set ivl=round(ivl),due=round(due) where ivl!=round(ivl) or due!=round(due)") if curs.rowcount: - problems.append("Fixed %d cards with v2 scheduler decimal interval bug." % curs.rowcount) - curs.execute("update cards set due=round(due) where due!=round(due)") + problems.append("Fixed %d cards with v2 scheduler bug." % curs.rowcount) + + curs.execute("update revlog set ivl=round(ivl),lastIvl=round(lastIvl) where ivl!=round(ivl) or lastIvl!=round(lastIvl)") if curs.rowcount: - problems.append("Fixed %d cards with v2 scheduler decimal due bug." % curs.rowcount) + problems.append("Fixed %d review history entries with v2 scheduler bug." % curs.rowcount) # and finally, optimize self.optimize() newSize = os.stat(self.path)[stat.ST_SIZE]