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

View File

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

View File

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

View File

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