parse the servings
This commit is contained in:
parent
c710d42ccb
commit
b9040cb3a4
@ -57,9 +57,13 @@ class RecetteTek(Integration):
|
|||||||
recipe.steps.add(step)
|
recipe.steps.add(step)
|
||||||
|
|
||||||
# Attempt to import prep/cooking times
|
# Attempt to import prep/cooking times
|
||||||
|
# quick hack, this assumes only one number in the quantity field.
|
||||||
try:
|
try:
|
||||||
if file['quantity'] != '':
|
if file['quantity'] != '':
|
||||||
recipe.servings = int(file['quantity'])
|
for item in file['quantity'].split(' '):
|
||||||
|
if item.isdigit():
|
||||||
|
recipe.servings = int(item)
|
||||||
|
break
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(recipe.name, ': failed to parse quantity ', str(e))
|
print(recipe.name, ': failed to parse quantity ', str(e))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user