From 963dad39e8375f158edb31609fda64a6ababea0d Mon Sep 17 00:00:00 2001 From: smilerz Date: Wed, 15 Dec 2021 14:42:12 -0600 Subject: [PATCH] fix rounding on new shopping list --- recipes/settings.py | 14 +++++++------- vue/src/apps/ShoppingListView/ShoppingListView.vue | 1 - vue/src/components/ShoppingLineItem.vue | 3 +++ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/recipes/settings.py b/recipes/settings.py index 7af4d12d1..80390509a 100644 --- a/recipes/settings.py +++ b/recipes/settings.py @@ -308,13 +308,13 @@ else: # SQLite testing DB # DATABASES = { -# 'default': { -# 'ENGINE': 'django.db.backends.sqlite3', -# 'OPTIONS': ast.literal_eval(os.getenv('DB_OPTIONS')) if os.getenv('DB_OPTIONS') else {}, -# 'NAME': 'db.sqlite3', -# 'CONN_MAX_AGE': 600, -# } -#} +# 'default': { +# 'ENGINE': 'django.db.backends.sqlite3', +# 'OPTIONS': ast.literal_eval(os.getenv('DB_OPTIONS')) if os.getenv('DB_OPTIONS') else {}, +# 'NAME': 'db.sqlite3', +# 'CONN_MAX_AGE': 600, +# } +# } CACHES = { 'default': { diff --git a/vue/src/apps/ShoppingListView/ShoppingListView.vue b/vue/src/apps/ShoppingListView/ShoppingListView.vue index 49368c989..783454a97 100644 --- a/vue/src/apps/ShoppingListView/ShoppingListView.vue +++ b/vue/src/apps/ShoppingListView/ShoppingListView.vue @@ -682,7 +682,6 @@ export default { this.settings = getUserPreference() this.delay = Number(this.settings.default_delay || 4) - console.log(this.delay) this.supermarket_categories_only = this.settings.filter_to_supermarket if (this.settings.shopping_auto_sync) { window.addEventListener("online", this.updateOnlineStatus) diff --git a/vue/src/components/ShoppingLineItem.vue b/vue/src/components/ShoppingLineItem.vue index 5478b521f..a47d1d92b 100644 --- a/vue/src/components/ShoppingLineItem.vue +++ b/vue/src/components/ShoppingLineItem.vue @@ -151,6 +151,9 @@ export default { } } }) + for (const [k, v] of Object.entries(amount)) { + amount[k] = Math.round(v * 100 + Number.EPSILON) / 100 // javascript hack to force rounding at 2 places + } return amount }, formatCategory: function () {