summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuval Adam <_@yuv.al>2020-09-28 23:15:02 +0300
committerYuval Adam <_@yuv.al>2020-09-28 23:15:02 +0300
commitc430f7eaa73ff0dacfdf7f0a1b8d14376c58058f (patch)
treeb82936e9e34a3bbf6af2a7099ad9b837df174698
parent6f522f855cbf3f698abdac5bed7005d5c8fd1705 (diff)
Drop grouped predictions and render table in vue
-rw-r--r--iss/server.py3
-rw-r--r--iss/templates/passes.html29
2 files changed, 12 insertions, 20 deletions
diff --git a/iss/server.py b/iss/server.py
index e8486ea..79fd5a6 100644
--- a/iss/server.py
+++ b/iss/server.py
@@ -27,12 +27,11 @@ async def home(request: Request, cf_connecting_ip: Optional[str] = Header(None))
@app.get("/passes/{lat}/{lng}")
async def passes(request: Request, lat: float, lng: float):
- preds = Predictions(lat, lng, altitude=0, days=5).get_grouped_predictions()
+ preds = Predictions(lat, lng, altitude=0, days=5).get_predictions()
return templates.TemplateResponse(
"passes.html",
{
"request": request,
- "predictions": preds,
"predictions_json": json.dumps(preds),
"location": {"lat": lat, "lng": lng},
},
diff --git a/iss/templates/passes.html b/iss/templates/passes.html
index 10fb52b..a0ea45e 100644
--- a/iss/templates/passes.html
+++ b/iss/templates/passes.html
@@ -16,7 +16,6 @@
<th colspan="2">Set</th>
</tr>
<tr class="pa1 f4">
- <th>Date</th>
<th>Length</th>
<th>Time</th>
<th>Azimuth</th>
@@ -27,23 +26,17 @@
<th>Time</th>
<th>Azimuth</th>
</tr>
- {% for date, preds in predictions.items() %}
- {% set date_loop = loop %}
- {% for pred in preds %}
- <tr class="pa1 {{ date_loop.cycle('light-silver', 'light-gray') }}">
- {% if loop.first %}<td rowspan="{{ preds|length }}">{{ date }}</td>{% endif %}
- <td>{{ pred.length }}</td>
- <td>{{ pred.rise.time }}</td>
- <td>{{ pred.rise.azimuth }} ({{ pred.rise.direction }})</td>
- <td>{{ pred.culminate.time }}</td>
- <td>{{ pred.culminate.azimuth }} ({{ pred.culminate.direction }})</td>
- <td>{{ pred.culminate.degrees }}</td>
- <td>{{ pred.culminate.distance }}</td>
- <td>{{ pred.set.time }}</td>
- <td>{{ pred.set.azimuth }} ({{ pred.set.direction }}) </td>
- </tr>
- {% endfor %}
- {% endfor %}
+ <tr class="pa1" v-for="pred in predictions">
+ <td>[[ pred.length ]]</td>
+ <td>[[ pred.rise.time ]]</td>
+ <td>[[ pred.rise.azimuth ]] ([[ pred.rise.direction ]])</td>
+ <td>[[ pred.culminate.time ]]</td>
+ <td>[[ pred.culminate.azimuth ]] ([[ pred.culminate.direction ]])</td>
+ <td>[[ pred.culminate.degrees ]]</td>
+ <td>[[ pred.culminate.distance ]]</td>
+ <td>[[ pred.set.time ]]</td>
+ <td>[[ pred.set.azimuth ]] ([[ pred.set.direction ]]) </td>
+ </tr>
</table>
</div>