From 7531c9cc7cc5ab8d9834b3d7d8cc93c0ed82032e Mon Sep 17 00:00:00 2001 From: Alexander Hosking Date: Thu, 29 Dec 2022 23:25:32 -0500 Subject: [PATCH] Add Winter parameter for Repeat entries --- influx_frontend.py | 6 +++--- templates/index.html | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/influx_frontend.py b/influx_frontend.py index 2adb7e9..f8c93df 100644 --- a/influx_frontend.py +++ b/influx_frontend.py @@ -126,8 +126,8 @@ def add_time(): return redirect(url_for('main_page')) -@app.route('/repeat_last_odometer/') -def repeat_last_odometer(odometer): +@app.route('/repeat_last_odometer//') +def repeat_last_odometer(odometer, winter=False): '''Retrieve the passed in odometer value and submit as a new entry''' date = strftime("%Y-%m-%d") time = strftime("%H:%M:%S") @@ -136,7 +136,7 @@ def repeat_last_odometer(odometer): write_api = client.write_api(write_options=SYNCHRONOUS) point = influxdb_client.Point("2016_odyssey").time( - timestamp).field("odometer", float(odometer)) + timestamp).tag("winter", winter).field("odometer", float(odometer)) write_api.write(bucket="gas", org=config['DB_ORG'], record=point) return redirect(url_for('main_page')) diff --git a/templates/index.html b/templates/index.html index 9b1cbe3..cd3d65d 100644 --- a/templates/index.html +++ b/templates/index.html @@ -57,13 +57,16 @@ {% endif %} + {% else %} + + {% endif %}
{% if data %} - Repeat + Repeat {% endif %}