diff --git a/pylib/anki/consts.py b/pylib/anki/consts.py index 001bf7a46..22da0d552 100644 --- a/pylib/anki/consts.py +++ b/pylib/anki/consts.py @@ -71,6 +71,7 @@ BUTTON_FOUR = 4 # Revlog types REVLOG_LRN = 0 +REVLOG_REV = 1 # Labels ########################################################################## diff --git a/pylib/anki/sched.py b/pylib/anki/sched.py index 530368875..04b65ba4c 100644 --- a/pylib/anki/sched.py +++ b/pylib/anki/sched.py @@ -946,7 +946,7 @@ select id from cards where did in %s and queue = 2 and due <= ? limit ?)""" card.lastIvl, card.factor, card.timeTaken(), - 1, + REVLOG_REV, ) try: diff --git a/pylib/anki/schedv2.py b/pylib/anki/schedv2.py index 6b11a5e5a..12b64f923 100644 --- a/pylib/anki/schedv2.py +++ b/pylib/anki/schedv2.py @@ -961,7 +961,7 @@ select id from cards where did in %s and queue = 2 and due <= ? limit ?)""" def _answerRevCard(self, card: Card, ease: int) -> None: delay = 0 early = bool(card.odid and (card.odue > self.today)) - type = early and 3 or 1 + type = early and 3 or REVLOG_REV if ease == BUTTON_ONE: delay = self._rescheduleLapse(card) diff --git a/pylib/anki/stats.py b/pylib/anki/stats.py index b2a6f8bd9..f606bef0e 100644 --- a/pylib/anki/stats.py +++ b/pylib/anki/stats.py @@ -154,7 +154,7 @@ body {background-image: url(data:image/png;base64,%s); } select count(), sum(time)/1000, sum(case when ease = 1 then 1 else 0 end), /* failed */ sum(case when type = {REVLOG_LRN} then 1 else 0 end), /* learning */ -sum(case when type = 1 then 1 else 0 end), /* review */ +sum(case when type = {REVLOG_REV} then 1 else 0 end), /* review */ sum(case when type = 2 then 1 else 0 end), /* relearn */ sum(case when type = 3 then 1 else 0 end) /* filter */ from revlog where id > ? """ @@ -549,14 +549,14 @@ group by day order by day""" select (cast((id/1000.0 - :cut) / 86400.0 as int))/:chunk as day, sum(case when type = {REVLOG_LRN} then 1 else 0 end), -- lrn count -sum(case when type = 1 and lastIvl < 21 then 1 else 0 end), -- yng count -sum(case when type = 1 and lastIvl >= 21 then 1 else 0 end), -- mtr count +sum(case when type = {REVLOG_REV} and lastIvl < 21 then 1 else 0 end), -- yng count +sum(case when type = {REVLOG_REV} and lastIvl >= 21 then 1 else 0 end), -- mtr count sum(case when type = 2 then 1 else 0 end), -- lapse count sum(case when type = 3 then 1 else 0 end), -- cram count sum(case when type = {REVLOG_LRN} then time/1000.0 else 0 end)/:tf, -- lrn time -- yng + mtr time -sum(case when type = 1 and lastIvl < 21 then time/1000.0 else 0 end)/:tf, -sum(case when type = 1 and lastIvl >= 21 then time/1000.0 else 0 end)/:tf, +sum(case when type = {REVLOG_REV} and lastIvl < 21 then time/1000.0 else 0 end)/:tf, +sum(case when type = {REVLOG_REV} and lastIvl >= 21 then time/1000.0 else 0 end)/:tf, sum(case when type = 2 then time/1000.0 else 0 end)/:tf, -- lapse time sum(case when type = 3 then time/1000.0 else 0 end)/:tf -- cram time from revlog %s @@ -856,7 +856,7 @@ select sum(case when ease = 1 then 0 else 1 end) / cast(count() as float) * 100, count() -from revlog where type in ({REVLOG_LRN},1,2) %s +from revlog where type in ({REVLOG_LRN},{REVLOG_REV},2) %s group by hour having count() > 30 order by hour""" % lim, cut=self.col.sched.dayCutoff - (rolloverHour * 3600),