From 6c1239ee9c98fd4ade2052c246f87e87d1768d90 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Thu, 23 Aug 2012 16:57:08 +0900 Subject: [PATCH] reset rep/lapse count on export --- anki/exporting.py | 2 +- anki/sched.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/anki/exporting.py b/anki/exporting.py index 0a1317612..53de4490c 100644 --- a/anki/exporting.py +++ b/anki/exporting.py @@ -161,7 +161,7 @@ class AnkiExporter(Exporter): data) else: # need to reset card state - self.dst.sched.forgetCards(cids) + self.dst.sched.resetCards(cids) # models for m in self.src.models.all(): if int(m['id']) in mids: diff --git a/anki/sched.py b/anki/sched.py index a6a0a0957..364a168a2 100644 --- a/anki/sched.py +++ b/anki/sched.py @@ -1216,6 +1216,12 @@ update cards set type=2,queue=2,ivl=:ivl,due=:due, usn=:usn, mod=:mod, factor=:fact where id=:id and odid=0""", d) + def resetCards(self, ids): + "Completely reset cards for export." + self.col.db.execute( + "update cards set reps=0, lapses=0 where id in " + ids2str(ids)) + self.forgetCards(ids) + # Repositioning new cards ##########################################################################