Compare commits
5 Commits
master
...
158c419747
| Author | SHA1 | Date | |
|---|---|---|---|
| 158c419747 | |||
| 79e5fdf56b | |||
| a9338805e2 | |||
| 7f82a288da | |||
| 8728d3028b |
@@ -164,6 +164,7 @@
|
|||||||
<ul id="consumable_{{vehicle.id}}_{{consumable.id}}_tabs" class="nav nav-tabs" data-tabs="tabs">
|
<ul id="consumable_{{vehicle.id}}_{{consumable.id}}_tabs" class="nav nav-tabs" data-tabs="tabs">
|
||||||
{{ nav_tab(vehicle.id|string + '_' + consumable.id|string + '_consumption', 'Consumption', true) }}
|
{{ nav_tab(vehicle.id|string + '_' + consumable.id|string + '_consumption', 'Consumption', true) }}
|
||||||
{{ nav_tab(vehicle.id|string + '_' + consumable.id|string + '_amount', 'Amount', false) }}
|
{{ nav_tab(vehicle.id|string + '_' + consumable.id|string + '_amount', 'Amount', false) }}
|
||||||
|
{{ nav_tab(vehicle.id|string + '_' + consumable.id|string + '_price', 'Price', false) }}
|
||||||
</ul>
|
</ul>
|
||||||
<div id="consumable_{{vehicle.id}}_{{consumable.id}}_content" class="tab-content ">
|
<div id="consumable_{{vehicle.id}}_{{consumable.id}}_content" class="tab-content ">
|
||||||
{{ tab_pane(
|
{{ tab_pane(
|
||||||
@@ -188,6 +189,17 @@
|
|||||||
false
|
false
|
||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
|
{{ tab_pane(
|
||||||
|
vehicle.id|string + '_' + consumable.id|string + '_price',
|
||||||
|
chart(
|
||||||
|
consumable.price,
|
||||||
|
'ref_' + vehicle.id|string + '_' + consumable.id|string + '_price',
|
||||||
|
'€ / '+consumable.unit,
|
||||||
|
url_for('create_pit_stop_form', vid=vehicle.id, cid=consumable.id)
|
||||||
|
),
|
||||||
|
false
|
||||||
|
)
|
||||||
|
}}
|
||||||
</div>
|
</div>
|
||||||
{{ tab_script('vehicle_' + vehicle.id|string + '_' + consumable.id|string + '_tabs') }}
|
{{ tab_script('vehicle_' + vehicle.id|string + '_' + consumable.id|string + '_tabs') }}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ class ConsumableStats:
|
|||||||
self.average_amount_used = 0
|
self.average_amount_used = 0
|
||||||
self.average_amount = []
|
self.average_amount = []
|
||||||
self.amounts = []
|
self.amounts = []
|
||||||
|
self.price = []
|
||||||
|
|
||||||
pitstops = [
|
pitstops = [
|
||||||
stop for stop in vehicle.pitstops if stop.consumable_id == consumable.id
|
stop for stop in vehicle.pitstops if stop.consumable_id == consumable.id
|
||||||
@@ -37,6 +38,7 @@ class ConsumableStats:
|
|||||||
for pitstop in pitstops:
|
for pitstop in pitstops:
|
||||||
self.overall_amount += pitstop.amount
|
self.overall_amount += pitstop.amount
|
||||||
self.amounts.append(StatsEvent(pitstop.date, pitstop.amount))
|
self.amounts.append(StatsEvent(pitstop.date, pitstop.amount))
|
||||||
|
self.price.append(StatsEvent(pitstop.date, pitstop.costs/pitstop.amount))
|
||||||
self.average_amount_fuelled = self.overall_amount / pitstop_count
|
self.average_amount_fuelled = self.overall_amount / pitstop_count
|
||||||
if pitstop_count > 1:
|
if pitstop_count > 1:
|
||||||
overall_distance = (
|
overall_distance = (
|
||||||
|
|||||||
@@ -41,8 +41,8 @@ class TestingConfig(Config):
|
|||||||
|
|
||||||
|
|
||||||
class ProductionConfig(Config):
|
class ProductionConfig(Config):
|
||||||
SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://root:{h}@database/pitstops'.format(
|
SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://pitstops:{h}@localhost/pitstops'.format(
|
||||||
h=os.environ.get('DATABASE_ENV_MYSQL_ROOT_PASSWORD'))
|
h=os.environ.get('MYSQL_PASSWORD'))
|
||||||
|
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
|
|||||||
@@ -7,3 +7,4 @@ markdown
|
|||||||
Flask-Limiter
|
Flask-Limiter
|
||||||
requests
|
requests
|
||||||
email_validator
|
email_validator
|
||||||
|
gunicorn
|
||||||
Reference in New Issue
Block a user