minor changes
This commit is contained in:
parent
e933473d07
commit
2f6f6fd7c8
|
@ -6,6 +6,7 @@ from flask import url_for
|
||||||
from flask import request, redirect, g
|
from flask import request, redirect, g
|
||||||
from contextlib import closing
|
from contextlib import closing
|
||||||
import os, os.path
|
import os, os.path
|
||||||
|
import time
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
DATABASE = '/data/rollerverbrauch.db'
|
DATABASE = '/data/rollerverbrauch.db'
|
||||||
|
@ -90,12 +91,16 @@ def createPitStop():
|
||||||
|
|
||||||
@app.route('/pitstops/createForm', methods=['GET'])
|
@app.route('/pitstops/createForm', methods=['GET'])
|
||||||
def createPitStopForm():
|
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)
|
return render_template('newPitStopForm.html', data=data)
|
||||||
|
|
||||||
@app.route('/pitstops', methods=['GET'])
|
@app.route('/pitstops', methods=['GET'])
|
||||||
def getPitStops():
|
def getPitStops():
|
||||||
data = {'pitstops': preparePitStops(getAllPitStops())}
|
data = preparePitStops(getAllPitStops())
|
||||||
|
data.reverse()
|
||||||
|
data = {'pitstops': data}
|
||||||
return render_template('pitstops.html', data=data)
|
return render_template('pitstops.html', data=data)
|
||||||
|
|
||||||
@app.route('/statistics', methods=['GET'])
|
@app.route('/statistics', methods=['GET'])
|
||||||
|
|
|
@ -20,4 +20,7 @@ td {
|
||||||
|
|
||||||
.error {
|
.error {
|
||||||
color: red;
|
color: red;
|
||||||
}]
|
}
|
||||||
|
|
||||||
|
.pitstop {
|
||||||
|
}
|
|
@ -7,48 +7,38 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<table>
|
<div class="table-responsive">
|
||||||
<tr>
|
<table class="table table-striped table-bordered table-condensed">
|
||||||
<th>
|
|
||||||
Date
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
Day
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
Odometer
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
Distance
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
Litres
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
Average
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
{% for pitstop in data['pitstops'] %}
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<th>
|
||||||
{{pitstop.date}}
|
Date<br />
|
||||||
</td>
|
Days
|
||||||
<td>
|
</th>
|
||||||
{% if pitstop.days %}{{pitstop.days}}{% else %} --{% endif %} days
|
<th>
|
||||||
</td>
|
Odometer<br />
|
||||||
<td>
|
Distance
|
||||||
{{pitstop.odometer}} km
|
</th>
|
||||||
</td>
|
<th>
|
||||||
<td>
|
Litres<br />
|
||||||
{% if pitstop.distance %}{{pitstop.distance}}{% else %} --{% endif %} km
|
Average
|
||||||
</td>
|
</th>
|
||||||
<td>
|
|
||||||
{{pitstop.litres}} l
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{% if pitstop.average %}{{pitstop.average}}{% else %} --{% endif %} l/100km
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% for pitstop in data['pitstops'] %}
|
||||||
</table>
|
<tr class='pitstop'>
|
||||||
|
<td>
|
||||||
|
{{pitstop.date}}<br />
|
||||||
|
{% if pitstop.days %}{{pitstop.days}}{% else %} --{% endif %} days
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{pitstop.odometer}} km<br />
|
||||||
|
{% if pitstop.distance %}{{pitstop.distance}}{% else %} --{% endif %} km
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{pitstop.litres}} l<br />
|
||||||
|
{% if pitstop.average %}{{pitstop.average}}{% else %} --{% endif %} l/100km
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
|
@ -7,30 +7,32 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<table>
|
<div class="table-responsive">
|
||||||
<tr>
|
<table class="table table-striped table-bordered table-condensed">
|
||||||
<th>Number of Pitstops:</th>
|
<tr>
|
||||||
<td>{{ data.count }}</td>
|
<th>Number of Pitstops:</th>
|
||||||
</tr>
|
<td>{{ data.count }}</td>
|
||||||
<tr>
|
</tr>
|
||||||
<th>Logged Distance:</th>
|
<tr>
|
||||||
<td>{{ data.distance }} km</td>
|
<th>Logged Distance:</th>
|
||||||
</tr>
|
<td>{{ data.distance }} km</td>
|
||||||
<tr>
|
</tr>
|
||||||
<th>Average Distance:</th>
|
<tr>
|
||||||
<td>{{ data.averageDistance }} km</td>
|
<th>Average Distance:</th>
|
||||||
</tr>
|
<td>{{ data.averageDistance }} km</td>
|
||||||
<tr>
|
</tr>
|
||||||
<th>Litres fuelled:</th>
|
<tr>
|
||||||
<td>{{ data.litres }} l</td>
|
<th>Litres fuelled:</th>
|
||||||
</tr>
|
<td>{{ data.litres }} l</td>
|
||||||
<tr>
|
</tr>
|
||||||
<th>Average Litres fuelled:</th>
|
<tr>
|
||||||
<td>{{ data.averageListresFuelled }} l</td>
|
<th>Average Litres fuelled:</th>
|
||||||
</tr>
|
<td>{{ data.averageListresFuelled }} l</td>
|
||||||
<tr>
|
</tr>
|
||||||
<th>Average Litres used:</th>
|
<tr>
|
||||||
<td>{{ data.averageListresUsed }} l/100km</td>
|
<th>Average Litres used:</th>
|
||||||
</tr>
|
<td>{{ data.averageListresUsed }} l/100km</td>
|
||||||
</table>
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
Loading…
Reference in New Issue