From 8a4d20de16bb1a58d35df8b4595a8b4b53046628 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sun, 6 May 2012 16:51:42 +0900 Subject: [PATCH] show # of reviews per hour --- anki/stats.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/anki/stats.py b/anki/stats.py index bd6fc02d7..77c87d93c 100644 --- a/anki/stats.py +++ b/anki/stats.py @@ -87,7 +87,7 @@ colLearn = "#00F" colRelearn = "#c00" colCram = "#ff0" colIvl = "#077" -colHour = "#777" +colHour = "#ccc" colTime = "#770" colUnseen = "#000" colSusp = "#ff0" @@ -488,6 +488,8 @@ order by thetype, ease""" % lim) if not data: return "" shifted = [] + counts = [] + mcount = 0 trend = [] peak = 0 for d in data: @@ -496,7 +498,11 @@ order by thetype, ease""" % lim) if pct > peak: peak = pct shifted.append((hour, pct)) + counts.append((hour, d[2])) + if d[2] > mcount: + mcount = d[2] shifted.sort() + counts.sort() for d in shifted: hour = d[0] pct = d[1] @@ -508,17 +514,18 @@ order by thetype, ease""" % lim) diff /= 3.0 diff = round(diff, 1) trend.append((hour, prev+diff)) - txt = self._title(_("Hourly Retention"), + txt = self._title(_("Hourly Breakdown"), _("Review success rate for each hour of the day.")) txt += self._graph(id="hour", data=[ - dict(data=shifted, color=colHour, label=_("% Correct")), - dict(data=trend, color=colCum, label=_("Trend"), - bars={'show': False}, lines=dict(show=True), stack=False) + dict(data=shifted, color=colCum, label=_("% Correct")), + dict(data=counts, color=colHour, label=_("Answers"), yaxis=2, + bars=dict(barWidth=0.2), stack=False) ], conf=dict( xaxis=dict(ticks=[[0, _("4AM")], [6, _("10AM")], [12, _("4PM")], [18, _("10PM")], [23, _("3AM")]]), - yaxis=dict(max=peak)), - ylabel=_("%Correct")) + yaxes=[dict(max=peak), dict(position="right", max=mcount)]), + ylabel=_("% Correct"), ylabel2=_("Reviews")) + txt += _("Hours with less than 30 reviews are not shown.") return txt def _hourRet(self):