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

View File

@ -7,7 +7,8 @@
{% endblock %}
{% block body %}
<table>
<div class="table-responsive">
<table class="table table-striped table-bordered table-condensed">
<tr>
<th>Number of Pitstops:</th>
<td>{{ data.count }}</td>
@ -33,4 +34,5 @@
<td>{{ data.averageListresUsed }} l/100km</td>
</tr>
</table>
</div>
{% endblock %}