mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 23:12:21 -04:00
give intervals a type too
This commit is contained in:
parent
91903a79be
commit
eba64a0d3d
1 changed files with 15 additions and 9 deletions
|
@ -25,13 +25,13 @@ class Graphs(object):
|
||||||
self._stats = None
|
self._stats = None
|
||||||
self.selective = selective
|
self.selective = selective
|
||||||
|
|
||||||
def report(self, type=0):
|
def report(self, type=2):
|
||||||
# 0=days, 1=weeks, 2=months
|
# 0=days, 1=weeks, 2=months
|
||||||
# period-dependent graphs
|
# period-dependent graphs
|
||||||
txt = self.dueGraph(type)
|
txt = self.dueGraph(type)
|
||||||
txt += self.repsGraph(type)
|
txt += self.repsGraph(type)
|
||||||
|
txt += self.ivlGraph(type)
|
||||||
# other graphs
|
# other graphs
|
||||||
txt += self.ivlGraph()
|
|
||||||
txt += self.easeGraph()
|
txt += self.easeGraph()
|
||||||
return "<script>%s</script><center>%s</center>" % (anki.js.all, txt)
|
return "<script>%s</script><center>%s</center>" % (anki.js.all, txt)
|
||||||
|
|
||||||
|
@ -179,19 +179,25 @@ group by day order by day""" % lim,
|
||||||
# Intervals
|
# Intervals
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
def ivlGraph(self):
|
def ivlGraph(self, type):
|
||||||
ivls = self._ivls()
|
ivls = self._ivls(type)
|
||||||
txt = self._graph(id="ivl", title=_("Intervals"), data=[
|
txt = self._graph(id="ivl", title=_("Intervals"), data=[
|
||||||
dict(data=ivls, color=colIvl)
|
dict(data=ivls, color=colIvl, label=_("All Types"))
|
||||||
])
|
])
|
||||||
return txt
|
return txt
|
||||||
|
|
||||||
def _ivls(self):
|
def _ivls(self, type):
|
||||||
|
if type == 0:
|
||||||
|
chunk = 1; lim = " and grp <= 30"
|
||||||
|
elif type == 1:
|
||||||
|
chunk = 7; lim = " and grp <= 52"
|
||||||
|
else:
|
||||||
|
chunk = 30; lim = ""
|
||||||
return self.deck.db.all("""
|
return self.deck.db.all("""
|
||||||
select ivl / 7 as grp, count() from cards
|
select ivl / :chunk as grp, count() from cards
|
||||||
where queue = 2 %s
|
where queue = 2 %s %s
|
||||||
group by grp
|
group by grp
|
||||||
order by grp""" % self._limit())
|
order by grp""" % (self._limit(), lim), chunk=chunk)
|
||||||
|
|
||||||
|
|
||||||
# Eases
|
# Eases
|
||||||
|
|
Loading…
Reference in a new issue