mirror of
https://github.com/ankitects/anki.git
synced 2025-11-09 14:17:13 -05:00
compress graph; show % correct instead; ignore hours with counts < 30
This commit is contained in:
parent
8085ba299e
commit
b422019970
1 changed files with 12 additions and 7 deletions
|
|
@ -457,9 +457,12 @@ order by thetype, ease""" % lim)
|
||||||
return ""
|
return ""
|
||||||
shifted = []
|
shifted = []
|
||||||
trend = []
|
trend = []
|
||||||
|
peak = 0
|
||||||
for d in data:
|
for d in data:
|
||||||
hour = (d[0] - 4) % 24
|
hour = (d[0] - 4) % 24
|
||||||
pct = d[1]
|
pct = d[1]
|
||||||
|
if pct > peak:
|
||||||
|
peak = pct
|
||||||
shifted.append((hour, pct))
|
shifted.append((hour, pct))
|
||||||
shifted.sort()
|
shifted.sort()
|
||||||
for d in shifted:
|
for d in shifted:
|
||||||
|
|
@ -473,16 +476,17 @@ order by thetype, ease""" % lim)
|
||||||
diff /= 3.0
|
diff /= 3.0
|
||||||
diff = round(diff, 1)
|
diff = round(diff, 1)
|
||||||
trend.append((hour, prev+diff))
|
trend.append((hour, prev+diff))
|
||||||
txt = self._title(_("Retention by hour"),
|
txt = self._title(_("Hourly Retention"),
|
||||||
_("Percentage of failures in each hour of the day."))
|
_("Review success rate for each hour of the day."))
|
||||||
txt += self._graph(id="hour", data=[
|
txt += self._graph(id="hour", data=[
|
||||||
dict(data=shifted, color=colHour, label=_("% Failed")),
|
dict(data=shifted, color=colHour, label=_("% Failed")),
|
||||||
dict(data=trend, color=colCum, label=_("Trend"),
|
dict(data=trend, color=colCum, label=_("Trend"),
|
||||||
bars={'show': False}, lines=dict(show=True), stack=False)
|
bars={'show': False}, lines=dict(show=True), stack=False)
|
||||||
], conf=dict(
|
], conf=dict(
|
||||||
xaxis=dict(ticks=[[0, _("4AM")], [6, _("10AM")],
|
xaxis=dict(ticks=[[0, _("4AM")], [6, _("10AM")],
|
||||||
[12, _("4PM")], [18, _("10PM")], [23, _("3AM")]])),
|
[12, _("4PM")], [18, _("10PM")], [23, _("3AM")]]),
|
||||||
ylabel=_("Failure%"))
|
yaxis=dict(max=peak)),
|
||||||
|
ylabel=_("% Correct"))
|
||||||
return txt
|
return txt
|
||||||
|
|
||||||
def _hourRet(self):
|
def _hourRet(self):
|
||||||
|
|
@ -493,10 +497,11 @@ order by thetype, ease""" % lim)
|
||||||
return self.deck.db.all("""
|
return self.deck.db.all("""
|
||||||
select
|
select
|
||||||
23 - ((cast((:cut - time/1000) / 3600.0 as int)) %% 24) as hour,
|
23 - ((cast((:cut - time/1000) / 3600.0 as int)) %% 24) as hour,
|
||||||
sum(case when ease = 1 then 1 else 0 end) /
|
sum(case when ease = 1 then 0 else 1 end) /
|
||||||
cast(count() as float) * 100
|
cast(count() as float) * 100,
|
||||||
|
count()
|
||||||
from revlog where type = 1 %s
|
from revlog where type = 1 %s
|
||||||
group by hour order by hour""" % lim,
|
group by hour having count() > 30 order by hour""" % lim,
|
||||||
cut=self.deck.sched.dayCutoff-(sd.hour*3600))
|
cut=self.deck.sched.dayCutoff-(sd.hour*3600))
|
||||||
|
|
||||||
# Cards
|
# Cards
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue