From 600c70edcb6d8cb5fa13994f2d5342b6132050e3 Mon Sep 17 00:00:00 2001 From: Arthur Milchior Date: Thu, 30 Jan 2020 18:09:54 -0800 Subject: [PATCH] REVLOG_CRAM --- pylib/anki/consts.py | 1 + pylib/anki/sched.py | 2 +- pylib/anki/schedv2.py | 2 +- pylib/anki/stats.py | 6 +++--- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pylib/anki/consts.py b/pylib/anki/consts.py index 2dc9962fc..c3efab33e 100644 --- a/pylib/anki/consts.py +++ b/pylib/anki/consts.py @@ -73,6 +73,7 @@ BUTTON_FOUR = 4 REVLOG_LRN = 0 REVLOG_REV = 1 REVLOG_RELRN = 2 +REVLOG_CRAM = 3 # Labels ########################################################################## diff --git a/pylib/anki/sched.py b/pylib/anki/sched.py index e277c06ce..06b039c11 100644 --- a/pylib/anki/sched.py +++ b/pylib/anki/sched.py @@ -556,7 +556,7 @@ did = ? and queue = 3 and due <= ? limit ?""", # ease 1=no, 2=yes, 3=remove conf = self._lrnConf(card) if card.odid and not card.wasNew: - type = 3 + type = REVLOG_CRAM elif card.type == 2: type = REVLOG_RELRN else: diff --git a/pylib/anki/schedv2.py b/pylib/anki/schedv2.py index f27552f90..72a73f020 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 REVLOG_REV + type = early and REVLOG_CRAM or REVLOG_REV if ease == BUTTON_ONE: delay = self._rescheduleLapse(card) diff --git a/pylib/anki/stats.py b/pylib/anki/stats.py index fe3f1e3a2..d462a9d37 100644 --- a/pylib/anki/stats.py +++ b/pylib/anki/stats.py @@ -156,7 +156,7 @@ 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 = {REVLOG_REV} then 1 else 0 end), /* review */ sum(case when type = {REVLOG_RELRN} then 1 else 0 end), /* relearn */ -sum(case when type = 3 then 1 else 0 end) /* filter */ +sum(case when type = {REVLOG_CRAM} then 1 else 0 end) /* filter */ from revlog where id > ? """ + lim, (self.col.sched.dayCutoff - 86400) * 1000, @@ -552,13 +552,13 @@ sum(case when type = {REVLOG_LRN} then 1 else 0 end), -- lrn 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 = {REVLOG_RELRN} then 1 else 0 end), -- lapse count -sum(case when type = 3 then 1 else 0 end), -- cram count +sum(case when type = {REVLOG_CRAM} 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 = {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 = {REVLOG_RELRN} 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 +sum(case when type = {REVLOG_CRAM} then time/1000.0 else 0 end)/:tf -- cram time from revlog %s group by day order by day""" % lim,