Skip to content

Adding an ingredient component with a weight of 0 causes a recipe to be unviewable #12

@AustinGrey

Description

@AustinGrey

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions