From 6ca40df643842932c9b36557ce69fd7a2ed0e6c4 Mon Sep 17 00:00:00 2001 From: Yuval Adam <_@yuv.al> Date: Mon, 28 Sep 2020 11:06:17 +0300 Subject: Calculate pass length --- iss/predictions.py | 2 ++ iss/server.py | 2 +- iss/templates/index.html | 5 ++++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/iss/predictions.py b/iss/predictions.py index 1bdd10e..bab9f17 100644 --- a/iss/predictions.py +++ b/iss/predictions.py @@ -59,7 +59,9 @@ class Predictions(object): } def get_prediction_details(self, rise, culminate, zet): + length = int((zet - rise) * 86400) return { + "length": length, "rise": self.get_position_details(rise), "culminate": self.get_position_details(culminate), "set": self.get_position_details(zet), diff --git a/iss/server.py b/iss/server.py index 8d5c273..90b2e58 100644 --- a/iss/server.py +++ b/iss/server.py @@ -13,7 +13,7 @@ templates = Jinja2Templates(directory="iss/templates") @app.get("/") async def home(request: Request): - preds = Predictions(34, 32).get_predictions() + preds = Predictions(34.7641, 32.0669, altitude=10).get_predictions() return templates.TemplateResponse( "index.html", {"request": request, "predictions": preds} ) diff --git a/iss/templates/index.html b/iss/templates/index.html index 6c93254..5c498c7 100644 --- a/iss/templates/index.html +++ b/iss/templates/index.html @@ -1,13 +1,15 @@ {% extends "base.html" %} {% block content %} - +
+ + @@ -19,6 +21,7 @@ {% for pred in predictions %} + -- cgit v1.3.1
Total Rise Culminate Set
Length Time Azimuth Time
{{ pred.length }} {{ pred.rise.time }} {{ pred.rise.azimuth }} {{ pred.culminate.time }}