undefined always first

This commit is contained in:
vabene1111 2024-01-20 02:51:23 +08:00
parent 7d74979859
commit 2b9c294c2a
2 changed files with 10 additions and 13 deletions

View File

@ -565,7 +565,6 @@ export default {
this.autosync_id = undefined this.autosync_id = undefined
let timeout = Math.max(this.user_preference_store.user_settings.shopping_auto_sync, 1) * 1000 // if disabled (shopping_auto_sync=0) check again after 1 second if enabled let timeout = Math.max(this.user_preference_store.user_settings.shopping_auto_sync, 1) * 1000 // if disabled (shopping_auto_sync=0) check again after 1 second if enabled
console.log('setting', this.user_preference_store.user_settings.shopping_auto_sync, 'timeout ', timeout)
this.autosync_id = setTimeout(() => { this.autosync_id = setTimeout(() => {
if (this.user_preference_store.user_settings.shopping_auto_sync > 0) { if (this.user_preference_store.user_settings.shopping_auto_sync > 0) {
this.shopping_list_store.autosync() this.shopping_list_store.autosync()

View File

@ -100,12 +100,12 @@ export const useShoppingListStore = defineStore(_STORE_ID, {
this.total_checked_food = total_checked_food this.total_checked_food = total_checked_food
// ordering // ordering
if (useUserPreferenceStore().device_settings.shopping_selected_grouping === this.GROUP_CATEGORY && useUserPreferenceStore().device_settings.shopping_selected_supermarket !== null) {
if (this.UNDEFINED_CATEGORY in structure) { if (this.UNDEFINED_CATEGORY in structure) {
ordered_structure.push(structure[this.UNDEFINED_CATEGORY]) ordered_structure.push(structure[this.UNDEFINED_CATEGORY])
Vue.delete(structure, this.UNDEFINED_CATEGORY) Vue.delete(structure, this.UNDEFINED_CATEGORY)
} }
if (useUserPreferenceStore().device_settings.shopping_selected_grouping === this.GROUP_CATEGORY && useUserPreferenceStore().device_settings.shopping_selected_supermarket !== null) {
for (let c of useUserPreferenceStore().device_settings.shopping_selected_supermarket.category_to_supermarket) { for (let c of useUserPreferenceStore().device_settings.shopping_selected_supermarket.category_to_supermarket) {
if (c.category.name in structure) { if (c.category.name in structure) {
ordered_structure.push(structure[c.category.name]) ordered_structure.push(structure[c.category.name])
@ -130,13 +130,11 @@ export const useShoppingListStore = defineStore(_STORE_ID, {
* @return {[{id: *, translatable_label: string},{id: *, translatable_label: string},{id: *, translatable_label: string}]} * @return {[{id: *, translatable_label: string},{id: *, translatable_label: string},{id: *, translatable_label: string}]}
*/ */
grouping_options: function () { grouping_options: function () {
return [{'id': this.GROUP_CATEGORY, 'translatable_label': 'Category'}, { return [
'id': this.GROUP_CREATED_BY, {'id': this.GROUP_CATEGORY, 'translatable_label': 'Category'},
'translatable_label': 'created_by' {'id': this.GROUP_CREATED_BY, 'translatable_label': 'created_by'},
}, { {'id': this.GROUP_RECIPE, 'translatable_label': 'Recipe'}
'id': this.GROUP_RECIPE, ]
'translatable_label': 'Recipe'
}]
}, },
/** /**
* checks if failed items are contained in the sync queue * checks if failed items are contained in the sync queue