From ff184f7e5da9a881efec7e7a946e4c047b55c729 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Sat, 14 Jun 2025 22:37:58 +0200 Subject: [PATCH] fixed ingredients without amount could count into missing properties --- cookbook/helper/property_helper.py | 4 ++-- vue3/src/components/display/PropertyView.vue | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cookbook/helper/property_helper.py b/cookbook/helper/property_helper.py index b7d4764bd..494ea58ee 100644 --- a/cookbook/helper/property_helper.py +++ b/cookbook/helper/property_helper.py @@ -48,7 +48,7 @@ class FoodPropertyHelper: found_property = False # if food has a value for the given property type (no matter if conversion is possible) has_property_value = False - if i.food.properties_food_amount == 0 or i.food.properties_food_unit is None: # if food is configured incorrectly + if i.food.properties_food_amount == 0 or i.food.properties_food_unit is None and not (i.amount == 0 or i.no_amount): # if food is configured incorrectly computed_properties[pt.id]['food_values'][i.food.id] = {'id': i.food.id, 'food': {'id': i.food.id, 'name': i.food.name}, 'value': None} computed_properties[pt.id]['missing_value'] = True else: @@ -62,7 +62,7 @@ class FoodPropertyHelper: computed_properties[pt.id]['food_values'] = self.add_or_create( computed_properties[p.property_type.id]['food_values'], c.food.id, (c.amount / i.food.properties_food_amount) * p.property_amount, c.food) if not found_property: - if i.amount == 0: # don't count ingredients without an amount as missing + if i.amount == 0 or i.no_amount: # don't count ingredients without an amount as missing computed_properties[pt.id]['missing_value'] = computed_properties[pt.id]['missing_value'] or False # don't override if another food was already missing computed_properties[pt.id]['food_values'][i.food.id] = {'id': i.food.id, 'food': {'id': i.food.id, 'name': i.food.name}, 'value': 0} else: diff --git a/vue3/src/components/display/PropertyView.vue b/vue3/src/components/display/PropertyView.vue index d5fede56c..c0ffc5eae 100644 --- a/vue3/src/components/display/PropertyView.vue +++ b/vue3/src/components/display/PropertyView.vue @@ -44,7 +44,7 @@