From 1f0c0fe384843e05aa025b61614f17cba00aa089 Mon Sep 17 00:00:00 2001 From: Peter Baumgartner Date: Tue, 4 Feb 2014 14:15:04 -0600 Subject: [PATCH] Workaround empty graph data. zip will push empty values which end up being `null` in javascript and breaking the graphs. This fixes it but need to investigate if it is *correct*. --- salmon/core/graph.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/salmon/core/graph.py b/salmon/core/graph.py index 1ffd791..2ed7f67 100644 --- a/salmon/core/graph.py +++ b/salmon/core/graph.py @@ -64,7 +64,12 @@ def fetch(self, from_time, until_time=None): start_time, end_time, step = time_info current = start_time times = [] - while current <= end_time: + while current <= end_time and len(times) <= len(values): + try: + if values[len(times)] is None: + break + except IndexError: + pass times.append(current) current += step return zip(times, values)