handle pitstops without costs properly

This commit is contained in:
jlusiardi 2022-05-13 16:48:08 +02:00
parent 158c419747
commit cd9fc4755e
1 changed files with 3 additions and 1 deletions

View File

@ -38,7 +38,9 @@ class ConsumableStats:
for pitstop in pitstops:
self.overall_amount += pitstop.amount
self.amounts.append(StatsEvent(pitstop.date, pitstop.amount))
self.price.append(StatsEvent(pitstop.date, pitstop.costs/pitstop.amount))
# some pitstops seem to have lost their costs...
if pitstop.costs:
self.price.append(StatsEvent(pitstop.date, pitstop.costs/pitstop.amount))
self.average_amount_fuelled = self.overall_amount / pitstop_count
if pitstop_count > 1:
overall_distance = (