From 95ce30c5a911dac7b9b2ff166f726bd0d737e5ee Mon Sep 17 00:00:00 2001 From: Namonay Date: Sun, 29 Sep 2024 01:09:34 +0200 Subject: [PATCH] Button logic is now working --- main.py | 3 ++- templates/home.html | 30 +++++++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 0456726..8715c43 100644 --- a/main.py +++ b/main.py @@ -27,7 +27,8 @@ def update(): @app.route("/", methods = ['GET']) def normal(): print(values.split(" ")) - return render_template('home.html', dates = wrap(values, 10), total = len(values.split(' ')), days = values.split(' ')[-1]) + return render_template('home.html', dates = wrap(values, 10), total = len(values.split(' ')), days = (datetime.datetime.today().date() - datetime.datetime.strptime(values.split(' ')[-1], "%Y-%m-%d").date()).days) + if __name__ == '__main__': app.run(host='0.0.0.0', port=5000, debug=1) diff --git a/templates/home.html b/templates/home.html index e54caee..74d708b 100644 --- a/templates/home.html +++ b/templates/home.html @@ -66,6 +66,34 @@ header { } +

ca42

@@ -85,4 +113,4 @@ header {
Incident
-

Note: Button doesn't actually work yet...

\ No newline at end of file +

Note: Un accident par jour pour éviter la redondance