From dea83b5720fdbba17d36e99a0ab687b4f2621dba Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Wed, 11 May 2022 19:31:44 +0200 Subject: [PATCH] fixed duplication of values in recipe editor --- vue/src/apps/RecipeEditView/RecipeEditView.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vue/src/apps/RecipeEditView/RecipeEditView.vue b/vue/src/apps/RecipeEditView/RecipeEditView.vue index 26dc6f7d..1a018322 100644 --- a/vue/src/apps/RecipeEditView/RecipeEditView.vue +++ b/vue/src/apps/RecipeEditView/RecipeEditView.vue @@ -1030,11 +1030,11 @@ export default { .listUnits(query, 1, this.options_limit) .then((response) => { this.units = response.data.results - + let unique_units = this.units.map(u => u.name) if (this.recipe !== undefined) { for (let s of this.recipe.steps) { for (let i of s.ingredients) { - if (i.unit !== null && i.unit.id === undefined) { + if (i.unit !== null && i.unit.id === undefined && !unique_units.includes(i.unit.name) ) { this.units.push(i.unit) } } @@ -1054,11 +1054,11 @@ export default { .listFoods(query, undefined, undefined, 1, this.options_limit) .then((response) => { this.foods = response.data.results - + let unique_foods = this.foods.map(f => f.name) if (this.recipe !== undefined) { for (let s of this.recipe.steps) { for (let i of s.ingredients) { - if (i.food !== null && i.food.id === undefined) { + if (i.food !== null && i.food.id === undefined && !unique_foods.includes(i.food.name)) { this.foods.push(i.food) } }