Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Remove test for empty common name.

Roland Geider65d60d321bbb
diff --git a/wger/nutrition/extract_info/off.py b/wger/nutrition/extract_info/off.py
index 5ca4b85b8..bb1f816c9 100644
--- a/wger/nutrition/extract_info/off.py
+++ b/wger/nutrition/extract_info/off.py
@@ -40,7 +40,7 @@ def extract_info_from_off(product_data: dict, language: int) -> IngredientData:
raise KeyError('Missing required nutrition key')
# Basics
- name = product_data.get('product_name')
+ name = product_data.get('product_name', '')
common_name = product_data.get('generic_name', '')
# If the energy is not available in kcal, convert from kJ
diff --git a/wger/nutrition/models/ingredient.py b/wger/nutrition/models/ingredient.py
index 6115acb88..312ec5f0b 100644
--- a/wger/nutrition/models/ingredient.py
+++ b/wger/nutrition/models/ingredient.py
@@ -463,10 +463,7 @@ class Ingredient(AbstractLicenseModel, models.Model):
return None
if not ingredient_data.name:
- return
-
- if not ingredient_data.common_name:
- return
+ return None
ingredient = cls(**ingredient_data.dict())
ingredient.save()