diff --git a/app/main.py b/app/main.py index 69fdae4..060b330 100644 --- a/app/main.py +++ b/app/main.py @@ -6,6 +6,7 @@ from flask import url_for from flask import request, redirect, g from contextlib import closing import os, os.path +import time app = Flask(__name__) DATABASE = '/data/rollerverbrauch.db' @@ -90,12 +91,16 @@ def createPitStop(): @app.route('/pitstops/createForm', methods=['GET']) def createPitStopForm(): - data = {'last':getLastPitStop(), 'error': None} + values = getLastPitStop() + values['date'] = time.strftime("%Y-%m-%d") + data = {'last': values, 'error': None} return render_template('newPitStopForm.html', data=data) @app.route('/pitstops', methods=['GET']) def getPitStops(): - data = {'pitstops': preparePitStops(getAllPitStops())} + data = preparePitStops(getAllPitStops()) + data.reverse() + data = {'pitstops': data} return render_template('pitstops.html', data=data) @app.route('/statistics', methods=['GET']) diff --git a/app/static/main.css b/app/static/main.css index b3f581e..29c3360 100644 --- a/app/static/main.css +++ b/app/static/main.css @@ -20,4 +20,7 @@ td { .error { color: red; -}] \ No newline at end of file +} + +.pitstop { +} \ No newline at end of file diff --git a/app/templates/pitstops.html b/app/templates/pitstops.html index 3458792..7517545 100644 --- a/app/templates/pitstops.html +++ b/app/templates/pitstops.html @@ -7,48 +7,38 @@ {% endblock %} {% block body %} - - - - - - - - - - {% for pitstop in data['pitstops'] %} +
+
- Date - - Day - - Odometer - - Distance - - Litres - - Average -
- - - - - - - - {% endfor %} -
- {{pitstop.date}} - - {% if pitstop.days %}{{pitstop.days}}{% else %} --{% endif %} days - - {{pitstop.odometer}} km - - {% if pitstop.distance %}{{pitstop.distance}}{% else %} --{% endif %} km - - {{pitstop.litres}} l - - {% if pitstop.average %}{{pitstop.average}}{% else %} --{% endif %} l/100km -
+ + Date
+ Days + + + Odometer
+ Distance + + + Litres
+ Average + + + {% for pitstop in data['pitstops'] %} + + + {{pitstop.date}}
+ {% if pitstop.days %}{{pitstop.days}}{% else %} --{% endif %} days + + + {{pitstop.odometer}} km
+ {% if pitstop.distance %}{{pitstop.distance}}{% else %} --{% endif %} km + + + {{pitstop.litres}} l
+ {% if pitstop.average %}{{pitstop.average}}{% else %} --{% endif %} l/100km + + + {% endfor %} + + {% endblock %} \ No newline at end of file diff --git a/app/templates/statistics.html b/app/templates/statistics.html index d930826..d54b457 100644 --- a/app/templates/statistics.html +++ b/app/templates/statistics.html @@ -7,30 +7,32 @@ {% endblock %} {% block body %} - - - - - - - - - - - - - - - - - - - - - - - - - -
Number of Pitstops:{{ data.count }}
Logged Distance:{{ data.distance }} km
Average Distance:{{ data.averageDistance }} km
Litres fuelled:{{ data.litres }} l
Average Litres fuelled:{{ data.averageListresFuelled }} l
Average Litres used:{{ data.averageListresUsed }} l/100km
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Number of Pitstops:{{ data.count }}
Logged Distance:{{ data.distance }} km
Average Distance:{{ data.averageDistance }} km
Litres fuelled:{{ data.litres }} l
Average Litres fuelled:{{ data.averageListresFuelled }} l
Average Litres used:{{ data.averageListresUsed }} l/100km
+
{% endblock %} \ No newline at end of file