From 457b0f5c7358d9f6cda58f735e8579c6297f9525 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sat, 26 Mar 2011 16:51:26 +0900 Subject: [PATCH] don't generate all the graphs at once --- anki/graphs.py | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/anki/graphs.py b/anki/graphs.py index c5587cca9..da71a40ab 100644 --- a/anki/graphs.py +++ b/anki/graphs.py @@ -25,17 +25,25 @@ class Graphs(object): self._stats = None self.selective = selective - def report(self): - txt = (self.dueGraph(0, 30, _("Due/Day")) + - self.dueGraph(0, 52, _("Due/Week"), chunk=7) + - self.dueGraph(0, None, _("Due/Month"), chunk=30) + - self.repsGraph(30, _("Reviewed/Day"), _("Time/Day")) + - self.repsGraph(52, _("Reviewed/Week"), _("Time/Week"), - chunk=7) + - self.repsGraph(None, _("Reviewed/Month"), _("Time/Month"), - chunk=30) + - self.ivlGraph() + - self.easeGraph()) + def report(self, type=0): + # 0=days, 1=weeks, 2=months + fc = _("Forecast") + rc = _("Review Count") + rt = _("Review Time") + txt = "" + # period-dependent graphs + if type == 0: + txt += self.dueGraph(0, 30, fc) + txt += self.repsGraph(30, rc, rt) + elif type == 1: + txt += self.dueGraph(0, 52, fc, chunk=7) + txt += self.repsGraph(52, rc, rt, chunk=7) + else: + txt += self.dueGraph(0, None, fc, chunk=30) + txt += self.repsGraph(None, rc, rt, chunk=30) + # other graphs + txt += self.ivlGraph() + txt += self.easeGraph() return "
%s
" % (anki.js.all, txt) # Due and cumulative due