From b120c61343b2f738b7d19fde8c92fbcc377f9441 Mon Sep 17 00:00:00 2001 From: Yuval Adam <_@yuv.al> Date: Sun, 27 Sep 2020 17:40:12 +0300 Subject: Initial prediction rendering in template --- iss/predictions.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'iss/predictions.py') diff --git a/iss/predictions.py b/iss/predictions.py index 29bcf2c..1bdd10e 100644 --- a/iss/predictions.py +++ b/iss/predictions.py @@ -77,7 +77,13 @@ class Predictions(object): # docs mention the possibilibity of several culminations # https://rhodesmill.org/skyfield/earth-satellites.html#finding-when-a-satellite-rises-and-sets # but this doesn't seem to happen in our case - return list(chunks(ts, 3)) + res = list(chunks(ts, 3)) + + if len(res[-1]) != 3: + # truncate the last event in case it's a partial one + res = res[:-1] + + return res def get_predictions(self): preds = self.get_prediction_events() -- cgit v1.3.1