mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 00:36:38 -04:00
skip overview graph if there's no data
This commit is contained in:
parent
2dc9878435
commit
d0b92313e8
1 changed files with 10 additions and 3 deletions
|
@ -41,18 +41,23 @@ class Reviewer(object):
|
||||||
<hr>
|
<hr>
|
||||||
<div id="placeholder" style="width:350px; height:100px;"></div>
|
<div id="placeholder" style="width:350px; height:100px;"></div>
|
||||||
<span class=sub>%(fcsub)s</span>
|
<span class=sub>%(fcsub)s</span>
|
||||||
<hr>
|
<hr class=sub>
|
||||||
%(opts)s
|
%(opts)s
|
||||||
</center>
|
</center>
|
||||||
|
|
||||||
<script id="source" language="javascript" type="text/javascript">
|
<script id="source" language="javascript" type="text/javascript">
|
||||||
$(function () {
|
$(function () {
|
||||||
var d = %(fcdata)s;
|
var d = %(fcdata)s;
|
||||||
|
if (d) {
|
||||||
$.plot($("#placeholder"), [
|
$.plot($("#placeholder"), [
|
||||||
{ data: d, bars: { show: true, barWidth: 0.8 } }
|
{ data: d, bars: { show: true, barWidth: 0.8 } }
|
||||||
], {
|
], {
|
||||||
xaxis: { ticks: [[0.4, "Today"]] }
|
xaxis: { ticks: [[0.4, "Today"]] }
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
$("#placeholder").hide();
|
||||||
|
$(".sub").hide();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
"""
|
"""
|
||||||
|
@ -120,8 +125,10 @@ $(function () {
|
||||||
]
|
]
|
||||||
|
|
||||||
def _ovForecast(self):
|
def _ovForecast(self):
|
||||||
return simplejson.dumps(tuple(
|
fc = self.mw.deck.sched.dueForecast(14)
|
||||||
enumerate(self.mw.deck.sched.dueForecast(14))))
|
if not sum(fc):
|
||||||
|
return "''"
|
||||||
|
return simplejson.dumps(tuple(enumerate(fc)))
|
||||||
|
|
||||||
def _ovOpts(self):
|
def _ovOpts(self):
|
||||||
if self.mw.deck.qconf['newCardOrder'] == NEW_CARDS_RANDOM:
|
if self.mw.deck.qconf['newCardOrder'] == NEW_CARDS_RANDOM:
|
||||||
|
|
Loading…
Reference in a new issue