diff options
| author | Yuval Adam <_@yuv.al> | 2020-09-28 11:06:17 +0300 |
|---|---|---|
| committer | Yuval Adam <_@yuv.al> | 2020-09-28 11:06:17 +0300 |
| commit | 6ca40df643842932c9b36557ce69fd7a2ed0e6c4 (patch) | |
| tree | 2a8ba7ee8273bc0cc28c8c804fd47f8a7b342cb7 | |
| parent | 891cbb41f9be3074549ff93cda3db22210bb1321 (diff) | |
Calculate pass length
| -rw-r--r-- | iss/predictions.py | 2 | ||||
| -rw-r--r-- | iss/server.py | 2 | ||||
| -rw-r--r-- | 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 %} -<table class="ba tl pa1"> +<table class="tl pa1"> <tr class="ba tc pa1 f3"> + <th colspan="1">Total</th> <th colspan="2">Rise</th> <th colspan="4">Culminate</th> <th colspan="2">Set</th> </tr> <tr class="pa1 f4"> + <th>Length</th> <th>Time</th> <th>Azimuth</th> <th>Time</th> @@ -19,6 +21,7 @@ </tr> {% for pred in predictions %} <tr class="pa1"> + <td>{{ pred.length }}</td> <td>{{ pred.rise.time }}</td> <td>{{ pred.rise.azimuth }}</td> <td>{{ pred.culminate.time }}</td> |
