diff --git a/influx_frontend.py b/influx_frontend.py index ecba7cc..648c9c9 100644 --- a/influx_frontend.py +++ b/influx_frontend.py @@ -16,7 +16,10 @@ def success(): @app.route('/', methods=['GET', 'POST']) def main_page(): - return render_template('index.html') + client = InfluxDBClient('localhost', 8086, 'root', 'root', 'gas') + query = 'select TOP(odometer, 5) from odyssey' + data = client.query(query) + return render_template('index.html', data=data) @app.route('/add_time', methods=['POST', 'GET']) def add_time(): @@ -32,6 +35,8 @@ def add_time(): time = now odometer = request.form['odometer'] oilhealth= request.form['oilhealth'] + if oilhealth != '': + oilhealth = float(oilhealth) fuel = request.form['fuel'] if fuel != '': fuel = float(fuel) diff --git a/templates/index.html b/templates/index.html index 369e299..36d9a0f 100644 --- a/templates/index.html +++ b/templates/index.html @@ -27,21 +27,21 @@
- +
- +
- +
- +
@@ -52,10 +52,19 @@
- +
- +
+Last Mileage +