From 6bb04dc56db0dead5913c66044dd8cef8f82b63a Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Mon, 12 Jun 2023 17:20:00 +0200 Subject: [PATCH] improved property functions --- cookbook/helper/property_helper.py | 2 +- vue/src/components/FoodEditor.vue | 1 + vue/src/components/PropertyViewComponent.vue | 8 ++++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/cookbook/helper/property_helper.py b/cookbook/helper/property_helper.py index b89f0bdad..7e09a13af 100644 --- a/cookbook/helper/property_helper.py +++ b/cookbook/helper/property_helper.py @@ -44,8 +44,8 @@ class FoodPropertyHelper: for pt in property_types: found_property = False if i.food.properties_food_amount == 0 or i.food.properties_food_unit is None: - computed_properties[pt.id]['missing_value'] = True computed_properties[pt.id]['food_values'][i.food.id] = {'id': i.food.id, 'food': i.food.name, 'value': 0} + computed_properties[pt.id]['missing_value'] = i.food.properties_food_unit is None else: for p in i.food.properties.all(): if p.property_type == pt: diff --git a/vue/src/components/FoodEditor.vue b/vue/src/components/FoodEditor.vue index 882bbc4b3..4d63824e1 100644 --- a/vue/src/components/FoodEditor.vue +++ b/vue/src/components/FoodEditor.vue @@ -293,6 +293,7 @@ export default { if (this.item1.id !== undefined) { pf = apiClient.retrieveFood(this.item1.id).then((r) => { this.food = r.data + this.food.properties_food_unit = {name: 'g'} }).catch(err => { StandardToasts.makeStandardToast(this, StandardToasts.FAIL_FETCH, err) }) diff --git a/vue/src/components/PropertyViewComponent.vue b/vue/src/components/PropertyViewComponent.vue index 14d37e4df..322c2e3a9 100644 --- a/vue/src/components/PropertyViewComponent.vue +++ b/vue/src/components/PropertyViewComponent.vue @@ -21,9 +21,9 @@ {{ $t('Recipe') }} - - - + + + @@ -53,7 +53,7 @@ -