From 9fc4b555758cccedfc5e5982e64dcd0d66b342ef Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Fri, 14 Jun 2019 09:15:48 +1000 Subject: [PATCH] fix v2 relearning reset bug https://anki.tenderapp.com/discussions/ankidesktop/34560-schedule-switching-bug --- anki/schedv2.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/anki/schedv2.py b/anki/schedv2.py index ce15876c5..04e002699 100644 --- a/anki/schedv2.py +++ b/anki/schedv2.py @@ -1595,13 +1595,20 @@ else type end), due = odue, odue = 0, odid = 0, usn = ? where odid != 0""", self.col.usn()) - def _removeAllFromLearning(self): + def _removeAllFromLearning(self, schedVer=2): # remove review cards from relearning - self.col.db.execute(""" -update cards set -due = odue, queue = 2, type = 2, mod = %d, usn = %d, odue = 0 -where queue in (1,3) and type in (2, 3) -""" % (intTime(), self.col.usn())) + if schedVer == 1: + self.col.db.execute(""" + update cards set + due = odue, queue = 2, type = 2, mod = %d, usn = %d, odue = 0 + where queue in (1,3) and type in (2, 3) + """ % (intTime(), self.col.usn())) + else: + self.col.db.execute(""" + update cards set + due = %d+ivl, queue = 2, type = 2, mod = %d, usn = %d, odue = 0 + where queue in (1,3) and type in (2, 3) + """ % (self.today, intTime(), self.col.usn())) # remove new cards from learning self.forgetCards(self.col.db.list( "select id from cards where queue in (1,3)")) @@ -1637,5 +1644,5 @@ where queue < 0""" % (intTime(), self.col.usn())) def moveToV2(self): self._emptyAllFiltered() - self._removeAllFromLearning() + self._removeAllFromLearning(schedVer=1) self._remapLearningAnswers("ease=ease+1 where ease in (2,3)")