Skip to content

Commit

Permalink
Fix setting the unit of an ingredient if the abbreviation is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
felixschndr committed May 29, 2024
1 parent 32e4b2d commit 623d5e3
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions source/ingredient.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,17 @@ def _parse_input_with_ingredient_amounts(self) -> None:

quantity = self.ingredient_input.get("quantity", None)
if quantity:
self.specification += str(quantity)
self.specification += f"{str(quantity)} "

unit = self.ingredient_input.get("unit", None)
self.log.debug(f"Unit: {unit}")
if unit:
unit_formatted = unit.get("abbreviation", unit["name"])
self.log.debug(f"In if: {unit_formatted}")
self.specification += unit_formatted
abbreviation = unit["abbreviation"]
name = unit["name"]
if abbreviation:
self.specification += abbreviation
elif name:
self.specification += name

self.log.debug(f"Specification afterwards: {self.specification}")

Expand Down

0 comments on commit 623d5e3

Please sign in to comment.