From 1343101addcddbce58e18f5668d3f7e8b60e905d Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sat, 20 Jan 2018 14:22:57 +1000 Subject: [PATCH] fix counts in preview mode We can't preserve the original queues when in preview mode, as otherwise the due counts report the remaining steps of cards in the learning queue, instead of just 1. Rather than the rather complicated approach of making the learning and deck list code aware of the current mode we're in, preview mode moves all cards to the review queue when the filtered deck is built - just as cards are moved to the new queue in Anki 2.0.x. The reason for the review queue is that users were frequently confused when cards appeared as new - hopefully this is slightly less confusing. --- anki/schedv2.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/anki/schedv2.py b/anki/schedv2.py index f132039c9..e5ae9ffbc 100644 --- a/anki/schedv2.py +++ b/anki/schedv2.py @@ -114,7 +114,7 @@ class Scheduler: counts = [self.newCount, self.lrnCount, self.revCount] if card: idx = self.countIdx(card) - if idx == 1: + if idx == 1 and not self._previewingCard(card): counts[1] += card.left // 1000 else: counts[idx] += 1 @@ -1074,17 +1074,23 @@ group by did def _moveToDyn(self, did, ids, start=-100000): deck = self.col.decks.get(did) data = [] - t = intTime(); u = self.col.usn() + u = self.col.usn() due = start for id in ids: data.append((did, due, u, id)) due += 1 + queue = "" + if not deck['resched']: + queue = ",queue=2" + query = """ update cards set odid = did, odue = due, -did = ?, due = ?, usn = ? where id = ? -""" +did = ?, due = ?, usn = ? +%s +where id = ? +""" % queue self.col.db.executemany(query, data) def _removeFromFiltered(self, card):