From cd9fc4755e8ad78439f9616e9045d31c24e5659e Mon Sep 17 00:00:00 2001 From: jlusiardi Date: Fri, 13 May 2022 16:48:08 +0200 Subject: [PATCH] handle pitstops without costs properly --- app/tools.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/tools.py b/app/tools.py index 08771b5..90a1cb2 100644 --- a/app/tools.py +++ b/app/tools.py @@ -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 = (