From 5dc418060e857571957065b7646c87c578e7b051 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Thu, 31 Mar 2011 13:11:37 +0900 Subject: [PATCH] fix forecost avg calculation --- anki/stats.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/anki/stats.py b/anki/stats.py index 1f9dab791..ff0990266 100644 --- a/anki/stats.py +++ b/anki/stats.py @@ -143,11 +143,12 @@ table * { font-size: 14px; } txt += self._graph(id="due", data=data, conf=dict( xaxis=xaxis, yaxes=[dict(), dict(tickDecimals=0, position="right")])) - txt += self._dueInfo(tot, len(totd)) + txt += self._dueInfo(tot, len(totd)*chunk) return txt def _dueInfo(self, tot, num): - txt = _("Average: %s") % self._dayWeekMonth( + txt = _("Total: %s reviews") % tot + txt += "
" + _("Average: %s") % self._avgDay( tot, num, _("reviews")) return txt @@ -233,7 +234,6 @@ group by day order by day""" % (self._limit(), lim), period = self._periodDays() if not period: period = first - print period, first txt = _("Days studied: %(pct)d%% (%(x)s of %(y)s)") % dict( x=studied, y=period, pct=studied/float(period)*100) if convHours: @@ -245,9 +245,9 @@ group by day order by day""" % (self._limit(), lim), if convHours: # convert to minutes tot *= 60 - txt += "
"+_("Average over studied: %s") % self._dayWeekMonth( + txt += "
"+_("Average over studied: %s") % self._avgDay( tot, studied, unit) - txt += "
"+_("If you studied every day: %s") % self._dayWeekMonth( + txt += "
"+_("If you studied every day: %s") % self._avgDay( tot, period, unit) return txt @@ -608,7 +608,7 @@ $(function () { else: return None - def _dayWeekMonth(self, tot, num, unit): + def _avgDay(self, tot, num, unit): vals = [] try: vals.append(_("%d %s/day") % (tot/float(num), unit))