minor changes

This commit is contained in:
joachim lusiardi 2015-03-12 08:02:17 +01:00
parent e933473d07
commit 2f6f6fd7c8
4 changed files with 72 additions and 72 deletions

View File

@ -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'])

View File

@ -20,4 +20,7 @@ td {
.error {
color: red;
}]
}
.pitstop {
}

View File

@ -7,48 +7,38 @@
{% endblock %}
{% block body %}
<table>
<tr>
<th>
Date
</th>
<th>
Day
</th>
<th>
Odometer
</th>
<th>
Distance
</th>
<th>
Litres
</th>
<th>
Average
</th>
</tr>
{% for pitstop in data['pitstops'] %}
<div class="table-responsive">
<table class="table table-striped table-bordered table-condensed">
<tr>
<td>
{{pitstop.date}}
</td>
<td>
{% if pitstop.days %}{{pitstop.days}}{% else %} --{% endif %} days
</td>
<td>
{{pitstop.odometer}} km
</td>
<td>
{% if pitstop.distance %}{{pitstop.distance}}{% else %} --{% endif %} km
</td>
<td>
{{pitstop.litres}} l
</td>
<td>
{% if pitstop.average %}{{pitstop.average}}{% else %} --{% endif %} l/100km
</td>
<th>
Date<br />
Days
</th>
<th>
Odometer<br />
Distance
</th>
<th>
Litres<br />
Average
</th>
</tr>
{% endfor %}
</table>
{% for pitstop in data['pitstops'] %}
<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 %}

View File

@ -7,30 +7,32 @@
{% endblock %}
{% block body %}
<table>
<tr>
<th>Number of Pitstops:</th>
<td>{{ data.count }}</td>
</tr>
<tr>
<th>Logged Distance:</th>
<td>{{ data.distance }} km</td>
</tr>
<tr>
<th>Average Distance:</th>
<td>{{ data.averageDistance }} km</td>
</tr>
<tr>
<th>Litres fuelled:</th>
<td>{{ data.litres }} l</td>
</tr>
<tr>
<th>Average Litres fuelled:</th>
<td>{{ data.averageListresFuelled }} l</td>
</tr>
<tr>
<th>Average Litres used:</th>
<td>{{ data.averageListresUsed }} l/100km</td>
</tr>
</table>
<div class="table-responsive">
<table class="table table-striped table-bordered table-condensed">
<tr>
<th>Number of Pitstops:</th>
<td>{{ data.count }}</td>
</tr>
<tr>
<th>Logged Distance:</th>
<td>{{ data.distance }} km</td>
</tr>
<tr>
<th>Average Distance:</th>
<td>{{ data.averageDistance }} km</td>
</tr>
<tr>
<th>Litres fuelled:</th>
<td>{{ data.litres }} l</td>
</tr>
<tr>
<th>Average Litres fuelled:</th>
<td>{{ data.averageListresFuelled }} l</td>
</tr>
<tr>
<th>Average Litres used:</th>
<td>{{ data.averageListresUsed }} l/100km</td>
</tr>
</table>
</div>
{% endblock %}