diff --git a/anki/stats.py b/anki/stats.py index ff0990266..91ebf42af 100644 --- a/anki/stats.py +++ b/anki/stats.py @@ -147,10 +147,11 @@ table * { font-size: 14px; } return txt def _dueInfo(self, tot, num): - txt = _("Total: %s reviews") % tot - txt += "
" + _("Average: %s") % self._avgDay( - tot, num, _("reviews")) - return txt + i = [] + self._line(i, _("Total"), _("%d reviews") % tot) + self._line(i, _("Average"), self._avgDay( + tot, num, _("reviews"))) + return self._lineTbl(i) def _due(self, start=None, end=None, chunk=1): lim = "" @@ -234,22 +235,25 @@ group by day order by day""" % (self._limit(), lim), period = self._periodDays() if not period: period = first - txt = _("Days studied: %(pct)d%% (%(x)s of %(y)s)") % dict( - x=studied, y=period, pct=studied/float(period)*100) + i = [] + self._line(i, _("Days studied"), + _("%(pct)d%% (%(x)s of %(y)s)") % dict( + x=studied, y=period, pct=studied/float(period)*100), + bold=False) if convHours: tunit = _("hours") else: tunit = unit - txt += "
"+_("Total: %(tot)s %(unit)s") % dict( - unit=tunit, tot=int(tot)) + self._line(i, _("Total"), _("%(tot)s %(unit)s") % dict( + unit=tunit, tot=int(tot))) if convHours: # convert to minutes tot *= 60 - txt += "
"+_("Average over studied: %s") % self._avgDay( - tot, studied, unit) - txt += "
"+_("If you studied every day: %s") % self._avgDay( - tot, period, unit) - return txt + self._line(i, _("Average over studied"), self._avgDay( + tot, studied, unit)) + self._line(i, _("If you studied every day"), self._avgDay( + tot, period, unit)) + return self._lineTbl(i) def _splitRepData(self, data, spec): sep = {} @@ -356,9 +360,10 @@ group by day order by day)""" % lim, bars={'show': False}, lines=dict(show=True), stack=False) ], conf=dict( yaxes=[dict(), dict(position="right", max=105)])) - txt += _("Average interval: %s") % fmtTimeSpan(avg*86400) - txt += "
" + _("Longest interval: %s") % fmtTimeSpan(max*86400) - return txt + i = [] + self._line(i, _("Average interval"), fmtTimeSpan(avg*86400)) + self._line(i, _("Longest interval"), fmtTimeSpan(max*86400)) + return txt + self._lineTbl(i) def _ivls(self): if self.type == 0: @@ -486,8 +491,14 @@ when you answer "good" on a review.''') info) return txt - def _line(self, i, a, b): - i.append(("%s:%s") % (a,b)) + def _line(self, i, a, b, bold=True): + if bold: + i.append(("%s:%s") % (a,b)) + else: + i.append(("%s:%s") % (a,b)) + + def _lineTbl(self, i): + return "" + "".join(i) + "
" def _factors(self): return self.deck.db.first("""