Clean up code

This commit is contained in:
Jian Li 2019-03-10 18:20:08 -07:00
parent c4f9a35af4
commit 08e51f220f

View file

@ -240,10 +240,13 @@ from revlog where id > ? """+lim, (self.col.sched.dayCutoff-86400)*1000)
xaxis = dict(tickDecimals=0, min=-0.5) xaxis = dict(tickDecimals=0, min=-0.5)
if end is not None: if end is not None:
xaxis['max'] = end-0.5 xaxis['max'] = end-0.5
txt += self._graph(id="due", data=data, xunit=chunk, txt += self._graph(
ylabel2=_("Cumulative Cards"), conf=dict( id="due", data=data, xunit=chunk, ylabel2=_("Cumulative Cards"),
xaxis=xaxis, yaxes=[dict(min=0), dict( conf=dict(
min=0, tickDecimals=0, position="right")])) xaxis=xaxis, yaxes=[
dict(min=0), dict(min=0, tickDecimals=0, position="right")]
),
)
txt += self._dueInfo(tot, len(totd)*chunk) txt += self._dueInfo(tot, len(totd)*chunk)
return txt return txt
@ -286,14 +289,14 @@ group by day order by day""" % (self._limit(), lim),
return "" return ""
conf = dict( conf = dict(
xaxis=dict(tickDecimals=0, max=0.5), xaxis=dict(tickDecimals=0, max=0.5),
yaxes=[dict(min=0), dict(position="right",min=0)]) yaxes=[dict(min=0), dict(position="right", min=0)])
if days is not None: if days is not None:
conf['xaxis']['min'] = -days+0.5 conf['xaxis']['min'] = -days+0.5
def plot(id, data, ylabel, ylabel2): def plot(id, data, ylabel, ylabel2):
return self._graph( return self._graph(
id, data=data, conf=conf, xunit=chunk, ylabel=ylabel, ylabel2=ylabel2) id, data=data, conf=conf, xunit=chunk, ylabel=ylabel, ylabel2=ylabel2)
# graph # graph
(repdata, repsum) = self._splitRepData(data, ((1, colLearn, ""),)) repdata, repsum = self._splitRepData(data, ((1, colLearn, ""),))
txt = self._title( txt = self._title(
_("Added"), _("The number of new cards you have added.")) _("Added"), _("The number of new cards you have added."))
txt += plot("intro", repdata, ylabel=_("Cards"), ylabel2=_("Cumulative Cards")) txt += plot("intro", repdata, ylabel=_("Cards"), ylabel2=_("Cumulative Cards"))
@ -317,7 +320,7 @@ group by day order by day""" % (self._limit(), lim),
return "" return ""
conf = dict( conf = dict(
xaxis=dict(tickDecimals=0, max=0.5), xaxis=dict(tickDecimals=0, max=0.5),
yaxes=[dict(min=0), dict(position="right",min=0)]) yaxes=[dict(min=0), dict(position="right", min=0)])
if days is not None: if days is not None:
conf['xaxis']['min'] = -days+0.5 conf['xaxis']['min'] = -days+0.5
def plot(id, data, ylabel, ylabel2): def plot(id, data, ylabel, ylabel2):
@ -407,7 +410,6 @@ group by day order by day""" % (self._limit(), lim),
for (n, col, lab) in spec: for (n, col, lab) in spec:
totcnt[n] = 0 totcnt[n] = 0
totd[n] = [] totd[n] = []
sum = []
for row in data: for row in data:
for (n, col, lab) in spec: for (n, col, lab) in spec:
if n not in sep: if n not in sep:
@ -836,8 +838,6 @@ from cards where did in %s""" % self._limit())
opacity=0.5, opacity=0.5,
color="#000" color="#000"
))) )))
#conf['legend'] = dict(show=False)
return ( return (
""" """
<table cellpadding=0 cellspacing=10> <table cellpadding=0 cellspacing=10>