From ae3818611df36ba3592a9ce22ff8fff7d2ddbec1 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Sat, 23 Dec 2023 08:46:42 +0100 Subject: [PATCH] fixed checking food always works --- vue/src/components/ShoppingLineItem.vue | 18 ++++++++++-------- vue/src/stores/ShoppingListStore.js | 4 ++-- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/vue/src/components/ShoppingLineItem.vue b/vue/src/components/ShoppingLineItem.vue index 67a5ff44..a39f77c6 100644 --- a/vue/src/components/ShoppingLineItem.vue +++ b/vue/src/components/ShoppingLineItem.vue @@ -12,13 +12,15 @@ -
-
{{ info_row }} INFO
-
+ + {{ info_row }} + - + + + @@ -35,7 +37,7 @@ {{ $t("Edit_Food") }} - {{$t('Delay')}} + {{ $t('Delay') }} {{ $t('Delete_All') }} @@ -99,9 +101,9 @@ export default { } }, computed: { - is_checked: function (){ + is_checked: function () { for (let i in this.entries) { - if(!this.entries[i].checked){ + if (!this.entries[i].checked) { return false } } @@ -172,7 +174,7 @@ export default { return recipes.join(', ') } - if (this.entries.length === 123) { + if (Object.keys(this.entries ).length === 1) { return "Abendessen 31.12" // TODO implement mealplan or manual } diff --git a/vue/src/stores/ShoppingListStore.js b/vue/src/stores/ShoppingListStore.js index 9e97cc95..4813fe30 100644 --- a/vue/src/stores/ShoppingListStore.js +++ b/vue/src/stores/ShoppingListStore.js @@ -115,14 +115,14 @@ export const useShoppingListStore = defineStore(_STORE_ID, { } Vue.set(this.category_food_entries[category]['foods'][entry.food.id]['entries'], entry.id, entry) }, - toggleFoodCheckedState(food) { + setFoodCheckedState(food, checked) { /** * function to handle user checking or unchecking a food */ let entries = this.category_food_entries[this.getFoodCategory(food)]['foods'][food.id]['entries'] for (let i in entries) { - entries[i].checked = !entries[i].checked + entries[i].checked = checked this.updateObject(entries[i]) } },