updated openeats importer

This commit is contained in:
vabene1111
2021-06-11 15:28:11 +02:00
parent c52cd359a1
commit 9856857c51
3 changed files with 8 additions and 1 deletions

View File

@@ -163,6 +163,8 @@ def parse(x):
# small utility functions to prevent emtpy unit/food creation
def get_unit(unit, space):
if not unit:
return None
if len(unit) > 0:
u, created = Unit.objects.get_or_create(name=unit, space=space)
return u
@@ -170,6 +172,8 @@ def get_unit(unit, space):
def get_food(food, space):
if not food:
return None
if len(food) > 0:
f, created = Food.objects.get_or_create(name=food, space=space)
return f