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.
This commit is contained in:
Damien Elmes 2018-01-20 14:22:57 +10:00
parent 6bddcc10e6
commit 1343101add

View file

@ -114,7 +114,7 @@ class Scheduler:
counts = [self.newCount, self.lrnCount, self.revCount] counts = [self.newCount, self.lrnCount, self.revCount]
if card: if card:
idx = self.countIdx(card) idx = self.countIdx(card)
if idx == 1: if idx == 1 and not self._previewingCard(card):
counts[1] += card.left // 1000 counts[1] += card.left // 1000
else: else:
counts[idx] += 1 counts[idx] += 1
@ -1074,17 +1074,23 @@ group by did
def _moveToDyn(self, did, ids, start=-100000): def _moveToDyn(self, did, ids, start=-100000):
deck = self.col.decks.get(did) deck = self.col.decks.get(did)
data = [] data = []
t = intTime(); u = self.col.usn() u = self.col.usn()
due = start due = start
for id in ids: for id in ids:
data.append((did, due, u, id)) data.append((did, due, u, id))
due += 1 due += 1
queue = ""
if not deck['resched']:
queue = ",queue=2"
query = """ query = """
update cards set update cards set
odid = did, odue = due, odid = did, odue = due,
did = ?, due = ?, usn = ? where id = ? did = ?, due = ?, usn = ?
""" %s
where id = ?
""" % queue
self.col.db.executemany(query, data) self.col.db.executemany(query, data)
def _removeFromFiltered(self, card): def _removeFromFiltered(self, card):