mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
PERIOD_YEAR
This commit is contained in:
parent
3fa0a07e2e
commit
c6013c40c5
1 changed files with 5 additions and 4 deletions
|
@ -14,6 +14,7 @@ from anki.utils import fmtTimeSpan, ids2str
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
||||||
PERIOD_MONTH = 0
|
PERIOD_MONTH = 0
|
||||||
|
PERIOD_YEAR = 1
|
||||||
|
|
||||||
|
|
||||||
class CardStats:
|
class CardStats:
|
||||||
|
@ -112,7 +113,7 @@ class CollectionStats:
|
||||||
|
|
||||||
# assumes jquery & plot are available in document
|
# assumes jquery & plot are available in document
|
||||||
def report(self, type=PERIOD_MONTH) -> str:
|
def report(self, type=PERIOD_MONTH) -> str:
|
||||||
# 0=month, 1=weeks, 2=months
|
# 0=month, 1=year, 2=months
|
||||||
self.type = type
|
self.type = type
|
||||||
from .statsbg import bg
|
from .statsbg import bg
|
||||||
|
|
||||||
|
@ -220,7 +221,7 @@ from revlog where id > ? """
|
||||||
start = 0
|
start = 0
|
||||||
if self.type == PERIOD_MONTH:
|
if self.type == PERIOD_MONTH:
|
||||||
end, chunk = 31, 1
|
end, chunk = 31, 1
|
||||||
elif self.type == 1:
|
elif self.type == PERIOD_YEAR:
|
||||||
end, chunk = 52, 7
|
end, chunk = 52, 7
|
||||||
else: # self.type == 2:
|
else: # self.type == 2:
|
||||||
end = None
|
end = None
|
||||||
|
@ -607,7 +608,7 @@ group by day order by day)"""
|
||||||
totd.append((grp, tot / float(all) * 100))
|
totd.append((grp, tot / float(all) * 100))
|
||||||
if self.type == PERIOD_MONTH:
|
if self.type == PERIOD_MONTH:
|
||||||
ivlmax = 31
|
ivlmax = 31
|
||||||
elif self.type == 1:
|
elif self.type == PERIOD_YEAR:
|
||||||
ivlmax = 52
|
ivlmax = 52
|
||||||
else:
|
else:
|
||||||
ivlmax = max(5, ivls[-1][0])
|
ivlmax = max(5, ivls[-1][0])
|
||||||
|
@ -713,7 +714,7 @@ select count(), avg(ivl), max(ivl) from cards where did in %s and queue = 2"""
|
||||||
return txt
|
return txt
|
||||||
|
|
||||||
def _easeInfo(self, eases) -> str:
|
def _easeInfo(self, eases) -> str:
|
||||||
types = {PERIOD_MONTH: [0, 0], 1: [0, 0], 2: [0, 0]}
|
types = {PERIOD_MONTH: [0, 0], PERIOD_YEAR: [0, 0], 2: [0, 0]}
|
||||||
for (type, ease, cnt) in eases:
|
for (type, ease, cnt) in eases:
|
||||||
if ease == 1:
|
if ease == 1:
|
||||||
types[type][0] += cnt
|
types[type][0] += cnt
|
||||||
|
|
Loading…
Reference in a new issue