adds tracking of costs

This commit adds a new field to each pitstop for tracking of
costs.
This includes:
* a new DB column
* a new field in the create pitstop form
* a new column in the pitstop overview
* new stats values related to costs
* 2 new graphs
This commit is contained in:
2016-06-21 21:06:41 +02:00
parent 2176579baa
commit 5b69a82e05
8 changed files with 96 additions and 5 deletions

View File

@@ -41,6 +41,14 @@
<th>Average Litres used:</th>
<td>{{ vehicle.average_litres_used | round(2) }} l/100km</td>
</tr>
<tr>
<th>Logged Costs:</th>
<td>{{ vehicle.overall_costs | round(2) }} €</td>
</tr>
<tr>
<th>Average Costs per Litre:</th>
<td>{{ vehicle.average_costs_per_litre | round(2) }} €/l</td>
</tr>
</table>
</div>
<ul id="charts_tabs" class="nav nav-tabs" data-tabs="tabs">
@@ -59,6 +67,16 @@
Odometer
</a>
</li>
<li>
<a href="#v{{vehicle.id}}_c4" id="i{{vehicle.id}}_c4" data-toggle="tab">
Costs per litre
</a>
</li>
<li>
<a href="#v{{vehicle.id}}_c5" id="i{{vehicle.id}}_c5" data-toggle="tab">
Costs
</a>
</li>
</ul>
<div id="charts_tabs-content" class="tab-content">
<div class="tab-pane active" id="v{{vehicle.id}}_c3">
@@ -97,6 +115,30 @@
</div>
{% endif %}
</div>
<div class="tab-pane " id="v{{vehicle.id}}_c4">
{% if vehicle.pitstop_count > 0 %}
<div id="costsPerLitre{{vehicle.id}}" style="width:100%; height:500px;"></div>
<script type="text/javascript">
{{ chartScript('costsPerLitre'+vehicle.id|str, vehicle.costsPerLitre, '€/l') }}
</script>
{% else %}
<div class="alert alert-warning" role="alert">
not enough data: <a href="{{ url_for('create_pit_stop_form', vid=vehicle.id) }}">log a pitstop</a>?
</div>
{% endif %}
</div>
<div class="tab-pane " id="v{{vehicle.id}}_c5">
{% if vehicle.pitstop_count > 0 %}
<div id="costs{{vehicle.id}}" style="width:100%; height:500px;"></div>
<script type="text/javascript">
{{ chartScript('costs'+vehicle.id|str, vehicle.costs, '€') }}
</script>
{% else %}
<div class="alert alert-warning" role="alert">
not enough data: <a href="{{ url_for('create_pit_stop_form', vid=vehicle.id) }}">log a pitstop</a>?
</div>
{% endif %}
</div>
</div>
</div>
{% endfor %}