From 9d21b82739ab446d6e9960a23c10b4a53a0f9b1d Mon Sep 17 00:00:00 2001 From: "C. Regis Wilson" Date: Mon, 5 Oct 2020 11:34:40 -0700 Subject: [PATCH] Fix index error when a new service (or one that doesn't have yesterday's cost) --- handler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handler.py b/handler.py index 4bc729f..9165d42 100644 --- a/handler.py +++ b/handler.py @@ -28,7 +28,7 @@ def sparkline(datapoints): return line def delta(costs): - if (costs[-1] >= 1 and costs[-2] >= 1): + if (len(costs) > 1 and costs[-1] >= 1 and costs[-2] >= 1): # This only handles positive numbers result = ((costs[-1]/costs[-2])-1)*100.0 else: