Skip to content

Commit 0cf7ce9

Browse files
authored
Merge pull request #2114 from wger-project/fix/ingredient-common-name
Remove test for empty common name.
2 parents b49eaf8 + 65d60d3 commit 0cf7ce9

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

wger/nutrition/extract_info/off.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def extract_info_from_off(product_data: dict, language: int) -> IngredientData:
4040
raise KeyError('Missing required nutrition key')
4141

4242
# Basics
43-
name = product_data.get('product_name')
43+
name = product_data.get('product_name', '')
4444
common_name = product_data.get('generic_name', '')
4545

4646
# If the energy is not available in kcal, convert from kJ

wger/nutrition/models/ingredient.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -463,10 +463,7 @@ def fetch_ingredient_from_off(cls, code: str):
463463
return None
464464

465465
if not ingredient_data.name:
466-
return
467-
468-
if not ingredient_data.common_name:
469-
return
466+
return None
470467

471468
ingredient = cls(**ingredient_data.dict())
472469
ingredient.save()

0 commit comments

Comments
 (0)