feat: Default To Fractions When Unit Is Empty (#3587)

Co-authored-by: Hayden <64056131+hay-kot@users.noreply.github.com>
This commit is contained in:
Michael Genson
2024-05-12 14:15:26 -05:00
committed by GitHub
parent 554b3fa749
commit c82549ccb4
4 changed files with 22 additions and 7 deletions

View File

@@ -187,7 +187,7 @@ class RecipeIngredientBase(MealieModel):
qty: float | Fraction
# decimal
if not self.unit or not self.unit.fraction:
if self.unit and not self.unit.fraction:
qty = round(self.quantity or 0, INGREDIENT_QTY_PRECISION)
if qty.is_integer():
return str(int(qty))