mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-01 04:10:06 -05:00
fixed ingredients without amount could count into missing properties
This commit is contained in:
@@ -48,7 +48,7 @@ class FoodPropertyHelper:
|
|||||||
found_property = False
|
found_property = False
|
||||||
# if food has a value for the given property type (no matter if conversion is possible)
|
# if food has a value for the given property type (no matter if conversion is possible)
|
||||||
has_property_value = False
|
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]['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
|
computed_properties[pt.id]['missing_value'] = True
|
||||||
else:
|
else:
|
||||||
@@ -62,7 +62,7 @@ class FoodPropertyHelper:
|
|||||||
computed_properties[pt.id]['food_values'] = self.add_or_create(
|
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)
|
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 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]['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}
|
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:
|
else:
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
<v-list-item border v-for="fv in dialogProperty.foodValues" :key="`${dialogProperty.id}_${fv.id}`">
|
<v-list-item border v-for="fv in dialogProperty.foodValues" :key="`${dialogProperty.id}_${fv.id}`">
|
||||||
<template #prepend>
|
<template #prepend>
|
||||||
<v-progress-circular size="55" width="5" :model-value="(fv.value/dialogProperty.propertyAmountTotal)*100"
|
<v-progress-circular size="55" width="5" :model-value="(fv.value/dialogProperty.propertyAmountTotal)*100"
|
||||||
:color="colorScale((fv.value/dialogProperty.propertyAmountTotal)*100)" v-if="fv.value != null">
|
:color="colorScale((fv.value/dialogProperty.propertyAmountTotal)*100)" v-if="fv.value != null && dialogProperty.propertyAmountTotal > 0">
|
||||||
{{ Math.round((fv.value / dialogProperty.propertyAmountTotal) * 100) }}%
|
{{ Math.round((fv.value / dialogProperty.propertyAmountTotal) * 100) }}%
|
||||||
</v-progress-circular>
|
</v-progress-circular>
|
||||||
<v-progress-circular size="55" width="5" v-if="fv.value == null">?</v-progress-circular>
|
<v-progress-circular size="55" width="5" v-if="fv.value == null">?</v-progress-circular>
|
||||||
|
|||||||
Reference in New Issue
Block a user