fixed shopping category headers showing when only containing delayed entries

This commit is contained in:
vabene1111
2024-03-09 07:56:22 +01:00
parent 9c92e0f4c0
commit bb77f80abf
2 changed files with 6 additions and 1 deletions

View File

@@ -75,7 +75,7 @@
<!-- --------------------------------------- shopping list table -->
<b-row v-for="c in shopping_list_store.get_entries_by_group" v-bind:key="c.id">
<b-col cols="12"
v-if="c.count_unchecked > 0 || user_preference_store.device_settings.shopping_show_checked_entries && (c.count_unchecked + c.count_checked) > 0">
v-if="(c.count_unchecked > 0 || user_preference_store.device_settings.shopping_show_checked_entries) && (c.count_unchecked + c.count_checked) > 0 && (c.count_delayed_unchecked < c.count_unchecked ||user_preference_store.device_settings.shopping_show_delayed_entries )">
<b-button-group class="w-100 mt-1"
:class="{'flex-row-reverse': useUserPreferenceStore().user_settings.left_handed}">
<b-button variant="info" block class="btn btn-block text-left">

View File

@@ -65,6 +65,7 @@ export const useShoppingListStore = defineStore(_STORE_ID, {
let count_checked = 0
let count_unchecked_food = 0
let count_checked_food = 0
let count_delayed_unchecked = 0
for (let fi in structure[i]['foods']) {
let food_checked = true
@@ -74,6 +75,9 @@ export const useShoppingListStore = defineStore(_STORE_ID, {
} else {
food_checked = false
count_unchecked++
if (structure[i]['foods'][fi]['entries'][ei].delay_until != null){
count_delayed_unchecked++
}
}
}
if (food_checked) {
@@ -87,6 +91,7 @@ export const useShoppingListStore = defineStore(_STORE_ID, {
Vue.set(structure[i], 'count_checked', count_checked)
Vue.set(structure[i], 'count_unchecked_food', count_unchecked_food)
Vue.set(structure[i], 'count_checked_food', count_checked_food)
Vue.set(structure[i], 'count_delayed_unchecked', count_delayed_unchecked)
total_unchecked += count_unchecked
total_checked += count_checked