From d51cdec73e3ab495f71d84eb311133d4a4bcbfe7 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 5 Feb 2019 12:26:36 +1000 Subject: [PATCH] fix v2 sched+hourly retention graph issue --- anki/stats.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/anki/stats.py b/anki/stats.py index a956f41ef..11e3350aa 100644 --- a/anki/stats.py +++ b/anki/stats.py @@ -698,7 +698,11 @@ order by thetype, ease""" % lim) lim = self._revlogLimit() if lim: lim = " and " + lim - sd = datetime.datetime.fromtimestamp(self.col.crt) + if self.col.schedVer() == 1: + sd = datetime.datetime.fromtimestamp(self.col.crt) + rolloverHour = sd.hour + else: + rolloverHour = self.col.conf["rollover"] pd = self._periodDays() if pd: lim += " and id > %d" % ((self.col.sched.dayCutoff-(86400*pd))*1000) @@ -710,7 +714,7 @@ cast(count() as float) * 100, count() from revlog where type in (0,1,2) %s group by hour having count() > 30 order by hour""" % lim, - cut=self.col.sched.dayCutoff-(sd.hour*3600)) + cut=self.col.sched.dayCutoff-(rolloverHour*3600)) # Cards ######################################################################