Adding an ingredient component with a weight of 0 causes a recipe to be unviewable
Opened this issue · 0 comments
AustinGrey commented
Adding 0 grams of an ingredient component to a recipe (possible with the api), causes that recipe to be unviewable. The program attempts to calculate the weight of the component at recipes/models.py/Component:334
if self.of_ingredient:
weight = self.weight or self.of_ingredient.serving * self.servings
But 0 is considered false, so it goes to calculate self.of_ingredient.serving * self.servings, which is (NoneType or DecimalType) * NoneType, and NoneType does not have a multiplication operator defined.