From 1c687f67a1706e8d9a4470e0def58cb578e76394 Mon Sep 17 00:00:00 2001
From: Andreas <andreasv@fsmpi.rwth-aachen.de>
Date: Mon, 21 Aug 2017 19:37:43 +0200
Subject: [PATCH] Inserting Zero values for HLS stats, closes #252

---
 stats.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/stats.py b/stats.py
index d57e0fc..098f683 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)
-- 
GitLab