diff --git a/anki/stats.py b/anki/stats.py
index 8de9fc754..0f9d972ed 100644
--- a/anki/stats.py
+++ b/anki/stats.py
@@ -376,7 +376,38 @@ class DeckStats(object):
def tr(a, b):
return "
%s | %s |
" % (a, b)
if existing and avgInt:
- html += "" + _("Average Reviews") + ""
+ html += "" + _("Recent Work") + ""
+ if sys.platform.startswith("darwin"):
+ html += ""
+ else:
+ html += ""
+ html += tr(_("In last week"),
+ ("%d reps/%d days") % (
+ self.getRepsDone(-7, 0),
+ self.getDaysReviewed(-7, 0)))
+ html += tr(_("In last month"),
+ ("%d reps/%d days") % (
+ self.getRepsDone(-30, 0),
+ self.getDaysReviewed(-30, 0)))
+ html += tr(_("In last 3 months"),
+ ("%d reps/%d days") % (
+ self.getRepsDone(-92, 0),
+ self.getDaysReviewed(-92, 0)))
+ html += tr(_("In last 6 months"),
+ ("%d reps/%d days") % (
+ self.getRepsDone(-182, 0),
+ self.getDaysReviewed(-182, 0)))
+ html += tr(_("In last year"),
+ ("%d reps/%d days") % (
+ self.getRepsDone(-365, 0),
+ self.getDaysReviewed(-365, 0)))
+ html += tr(_("Deck life"),
+ ("%d reps/%d days") % (
+ self.getRepsDone(-13000, 0),
+ self.getDaysReviewed(-13000, 0)))
+ html += "
"
+
+ html += "
" + _("Average Daily Reviews") + ""
if sys.platform.startswith("darwin"):
html += ""
else:
@@ -391,6 +422,12 @@ class DeckStats(object):
fmtFloat(self.getPastWorkloadPeriod(7))) + _("cards/day"))
html += tr(_("In last month"), ("%s ") % (
fmtFloat(self.getPastWorkloadPeriod(30))) + _("cards/day"))
+ html += tr(_("In last 3 months"), ("%s ") % (
+ fmtFloat(self.getPastWorkloadPeriod(92))) + _("cards/day"))
+ html += tr(_("In last 6 months"), ("%s ") % (
+ fmtFloat(self.getPastWorkloadPeriod(182))) + _("cards/day"))
+ html += tr(_("In last year"), ("%s ") % (
+ fmtFloat(self.getPastWorkloadPeriod(365))) + _("cards/day"))
html += "
"
html += "
" + _("Average Added") + ""
@@ -406,6 +443,15 @@ class DeckStats(object):
np = self.getNewPeriod(30)
html += tr(_("In last month"), _("%(a)d (%(b)s/day)") % (
{'a': np, 'b': fmtFloat(np / float(30))}))
+ np = self.getNewPeriod(92)
+ html += tr(_("In last 3 months"), _("%(a)d (%(b)s/day)") % (
+ {'a': np, 'b': fmtFloat(np / float(30))}))
+ np = self.getNewPeriod(182)
+ html += tr(_("In last 6 months"), _("%(a)d (%(b)s/day)") % (
+ {'a': np, 'b': fmtFloat(np / float(30))}))
+ np = self.getNewPeriod(365)
+ html += tr(_("In last year"), _("%(a)d (%(b)s/day)") % (
+ {'a': np, 'b': fmtFloat(np / float(30))}))
html += "
"
html += "
" + _("Average New Seen") + ""
@@ -419,6 +465,15 @@ class DeckStats(object):
np = self.getFirstPeriod(30)
html += tr(_("In last month"), _("%(a)d (%(b)s/day)") % (
{'a': np, 'b': fmtFloat(np / float(30))}))
+ np = self.getFirstPeriod(92)
+ html += tr(_("In last 3 months"), _("%(a)d (%(b)s/day)") % (
+ {'a': np, 'b': fmtFloat(np / float(30))}))
+ np = self.getFirstPeriod(182)
+ html += tr(_("In last 6 months"), _("%(a)d (%(b)s/day)") % (
+ {'a': np, 'b': fmtFloat(np / float(30))}))
+ np = self.getFirstPeriod(365)
+ html += tr(_("In last year"), _("%(a)d (%(b)s/day)") % (
+ {'a': np, 'b': fmtFloat(np / float(30))}))
html += ""
html += "
" + _("Card Ease") + "
"
@@ -428,10 +483,27 @@ class DeckStats(object):
"select avg(factor) from cards") + "
"
html += _("Highest factor: %.2f") % d.s.scalar(
"select max(factor) from cards") + "
"
- html = runFilter("deckStats", html)
+ html = runFilter("deckStats", html)
return html
+ def getDaysReviewed(self, start, finish):
+ now = datetime.datetime.today()
+ x = now + datetime.timedelta(start)
+ y = now + datetime.timedelta(finish)
+ return self.deck.s.scalar(
+ "select count() from stats where "
+ "day >= :x and day <= :y and reps > 0",
+ x=x, y=y)
+
+ def getRepsDone(self, start, finish):
+ now = datetime.datetime.today()
+ x = time.mktime((now + datetime.timedelta(start)).timetuple())
+ y = time.mktime((now + datetime.timedelta(finish)).timetuple())
+ return self.deck.s.scalar(
+ "select count() from reviewHistory where time >= :x and time <= :y",
+ x=x, y=y)
+
def getAverageInterval(self):
return self.deck.s.scalar(
"select sum(interval) / count(interval) from cards "