paprika improvements and importer fixes

This commit is contained in:
vabene1111
2021-04-05 17:55:06 +02:00
parent a8434ce745
commit 01a53ad8ec
7 changed files with 78 additions and 39 deletions

View File

@ -47,12 +47,13 @@ class RezKonv(Integration):
)
for ingredient in ingredients:
amount, unit, ingredient, note = parse(ingredient)
f = get_food(ingredient, self.request.space)
u = get_unit(unit, self.request.space)
step.ingredients.add(Ingredient.objects.create(
food=f, unit=u, amount=amount, note=note
))
if len(ingredient.strip()) > 0:
amount, unit, ingredient, note = parse(ingredient)
f = get_food(ingredient, self.request.space)
u = get_unit(unit, self.request.space)
step.ingredients.add(Ingredient.objects.create(
food=f, unit=u, amount=amount, note=note
))
recipe.steps.add(step)
return recipe