statistics: add a zero entry in empty stat results, for jqplot (#7061)

This commit is contained in:
Frédéric Péters 2015-04-28 16:13:03 +02:00
parent 6bad90e7f7
commit 9ceaebdac8
1 changed files with 5 additions and 0 deletions

View File

@ -112,6 +112,11 @@ def do_graphs_section(period_start=None, period_end=None, criterias=None):
monthly_totals = sql.get_monthly_totals(period_start, period_end, criterias)[-12:]
yearly_totals = sql.get_yearly_totals(period_start, period_end, criterias)[-10:]
if not monthly_totals:
monthly_totals = [('%s-%s' % datetime.date.today().timetuple()[:2], 0)]
if not yearly_totals:
yearly_totals = [(datetime.date.today().year, 0)]
weekday_totals = sql.get_weekday_totals(period_start, period_end, criterias)
weekday_line = []
weekday_names = [_('Sunday'), _('Monday'), _('Tuesday'),