diff --git a/pykeg/core/models.py b/pykeg/core/models.py index 5881dab75..a19184d0b 100644 --- a/pykeg/core/models.py +++ b/pykeg/core/models.py @@ -719,6 +719,8 @@ def remaining_volume_ml(self): return self.full_volume_ml - self.served_volume_ml - self.spilled_ml def percent_full(self): + if self.full_volume_ml is None or self.full_volume_ml <= 0: + return 0 result = float(self.remaining_volume_ml()) / float(self.full_volume_ml) * 100 result = max(min(result, 100), 0) return result