diff --git a/stats.py b/stats.py index d57e0fc8a09086d6ef7e00a3f05b2dda1f7f6b12..098f683e0b5e74fd9588ff44b73dee9c1a83696b 100644 --- a/stats.py +++ b/stats.py @@ -41,9 +41,19 @@ def stats_generic(req, param=None): if req not in statsqueries: return 404, 'Not found' rows = query(statsqueries[req], *(statsqueries[req].count('?')*[param])) - res = {} + if req == 'live_views': + res = {'x': [], 'y': []} + else: + res = {} + lastx = 0 for row in rows: for key, val in row.items(): + if req == 'live_views' and key == 'x' and lastx != int(val)-1: + for i in range(lastx, int(val)-1): + res['x'].append(i) + res['y'].append(0) + if key == 'x': + lastx = int(val) if key not in res: res[key] = [] res[key].append(val)