Return some zero's when recipe is empty.

Get rid of errors.
closes #12
This commit is contained in:
2024-06-20 11:26:08 -04:00
parent 0f6bed9707
commit dd9ae6cd21

View File

@ -173,6 +173,9 @@ class BatchRecipe(CustomModel):
@property
def net_kettle_deadspace(self):
if self.equipment is None:
return 0
# If hops in kettle deadspace
# No deadspace if its all filled with hop trub
if self.equipment.hops_remain_kettle:
@ -183,14 +186,20 @@ class BatchRecipe(CustomModel):
@property
def kettle_hose_loss(self):
if self.equipment is None:
return 0
return float(self.equipment.kettle_plumbing_loss)
@property
def kettle_dead_space(self):
if self.equipment is None:
return 0
return float(self.equipment.kettle_deadspace)
@property
def boil_off_gph(self):
if self.equipment is None:
return 0
return float(self.equipment.kettle_boil_rate)
@property
@ -212,7 +221,7 @@ class BatchRecipe(CustomModel):
17: '8D4C32', 18: '7C452D', 19: '6B3A1E', 20: '5D341A',
21: '4E2A0C', 22: '4A2727', 23: '361F1B', 24: '261716',
25: '231716', 26: '19100F', 27: '16100F', 28: '120D0C',
29: '100B0A', 30: '050B0A'
29: '100B0A', 30: '050B0A', 0: 'C1963C'
}
return '#{}'.format(srm_hex_lookup[int(self.srm)])
@ -220,7 +229,10 @@ class BatchRecipe(CustomModel):
@property
def bu_gu(self):
gu = (self.original_sg - 1) * 1000
return self.ibu_tinseth / gu
try:
return self.ibu_tinseth / gu
except ZeroDivisionError:
return 0
@property
def rbr(self): # .75 needs to be calculated number...