mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-02 12:49:02 -05:00
fixed property helper calculation
This commit is contained in:
@@ -71,7 +71,7 @@ class FoodPropertyHelper:
|
|||||||
# TODO move to central helper ? --> use defaultdict
|
# TODO move to central helper ? --> use defaultdict
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def add_or_create(d, key, value, food):
|
def add_or_create(d, key, value, food):
|
||||||
if key in d:
|
if key in d and d[key]['value']:
|
||||||
d[key]['value'] += value
|
d[key]['value'] += value
|
||||||
else:
|
else:
|
||||||
d[key] = {'id': food.id, 'food': food.name, 'value': value}
|
d[key] = {'id': food.id, 'food': food.name, 'value': value}
|
||||||
|
|||||||
Reference in New Issue
Block a user