summaryrefslogtreecommitdiff
path: root/waterspout_radar/web.py
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2023-04-04 23:37:03 +0200
committerAki <please@ignore.pl>2023-04-04 23:37:03 +0200
commitfd4ab7ef4410a435f8c7339e111f791f5fdc9d0b (patch)
tree45b5a40df27233a87e70494cca54800174842090 /waterspout_radar/web.py
parent33cc3c920c2e89abcf07cf5a1c181287748fadf3 (diff)
downloadwaterspout-radar-fd4ab7ef4410a435f8c7339e111f791f5fdc9d0b.zip
waterspout-radar-fd4ab7ef4410a435f8c7339e111f791f5fdc9d0b.tar.gz
waterspout-radar-fd4ab7ef4410a435f8c7339e111f791f5fdc9d0b.tar.bz2
Moved predictions page to templates
Diffstat (limited to 'waterspout_radar/web.py')
-rw-r--r--waterspout_radar/web.py17
1 files changed, 2 insertions, 15 deletions
diff --git a/waterspout_radar/web.py b/waterspout_radar/web.py
index a3ee09b..37905c3 100644
--- a/waterspout_radar/web.py
+++ b/waterspout_radar/web.py
@@ -7,18 +7,5 @@ app = flask.Flask(__name__)
@app.route("/")
def predictions():
- body = "<!doctype html><html lang='en'><meta charset='utf-8'><title>Predictions</title>"
- body += "<h1>Prediction</h1><hr>"
- body += "<table>"
- body += "<tr><th>Time<th>Low Clouds<th>&Delta;Temp<th>Depth<th>Wind<th>SWI</tr>"
- for prediction in sorted(_storage.Storage(".waterspout/predictions.json"), key=lambda x: (x.time, x.swi)):
- body += "<tr>"
- body += f"<td>{prediction.time}"
- body += f"<td>{prediction.low_clouds}"
- body += f"<td>{prediction.temperature_difference}"
- body += f"<td>{prediction.convective_cloud_depth}"
- body += f"<td>{prediction.wind}"
- body += f"<td>{prediction.swi}"
- body += "</tr>"
- body += "</table>"
- return body
+ predictions = sorted(_storage.Storage(".waterspout/predictions.json"), key=lambda x: (x.time, x.swi))
+ return flask.render_template("predictions.html", predictions=predictions)