From 1a1dd092d054ecfa58e345f6aeedd6ed0daaef19 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 22 Apr 2022 22:45:49 +0000 Subject: [PATCH 01/11] Bump django from 3.2.12 to 3.2.13 Bumps [django](https://github.com/django/django) from 3.2.12 to 3.2.13. - [Release notes](https://github.com/django/django/releases) - [Commits](https://github.com/django/django/compare/3.2.12...3.2.13) --- updated-dependencies: - dependency-name: django dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 77de8bec4..afcc0902f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -Django==3.2.12 +Django==3.2.13 cryptography==36.0.2 django-annoying==0.10.6 django-autocomplete-light==3.9.4 From 9b132e71f23217a3b72cff88257c0097d416e280 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Sat, 23 Apr 2022 01:21:13 +0200 Subject: [PATCH 02/11] screw up ingredient parser --- cookbook/helper/ingredient_parser.py | 8 ++-- .../tests/other/test_ingredient_parser.py | 44 +++++++++---------- cookbook/views/api.py | 5 +++ 3 files changed, 31 insertions(+), 26 deletions(-) diff --git a/cookbook/helper/ingredient_parser.py b/cookbook/helper/ingredient_parser.py index 4987e0b5b..ee4b8d916 100644 --- a/cookbook/helper/ingredient_parser.py +++ b/cookbook/helper/ingredient_parser.py @@ -124,7 +124,7 @@ class IngredientParser: def parse_amount(self, x): amount = 0 - unit = '' + unit = None note = '' did_check_frac = False @@ -155,7 +155,7 @@ class IngredientParser: except ValueError: unit = x[end:] - if unit.startswith('(') or unit.startswith('-'): # i dont know any unit that starts with ( or - so its likely an alternative like 1L (500ml) Water or 2-3 + if unit is not None and (unit.startswith('(') or unit.startswith('-')): # i dont know any unit that starts with ( or - so its likely an alternative like 1L (500ml) Water or 2-3 unit = '' note = x return amount, unit, note @@ -230,7 +230,7 @@ class IngredientParser: # a fraction for the amount if len(tokens) > 2: try: - if not unit == '': + if unit is not None: # a unit is already found, no need to try the second argument for a fraction # probably not the best method to do it, but I didn't want to make an if check and paste the exact same thing in the else as already is in the except # noqa: E501 raise ValueError @@ -252,7 +252,7 @@ class IngredientParser: # try to use second argument as unit and everything else as ingredient, use everything as ingredient if it fails # noqa: E501 try: ingredient, note = self.parse_ingredient(tokens[2:]) - if unit == '': + if unit is None: unit = tokens[1] else: note = tokens[1] diff --git a/cookbook/tests/other/test_ingredient_parser.py b/cookbook/tests/other/test_ingredient_parser.py index 5d61fa87d..d2d6b144a 100644 --- a/cookbook/tests/other/test_ingredient_parser.py +++ b/cookbook/tests/other/test_ingredient_parser.py @@ -10,33 +10,33 @@ def test_ingredient_parser(): "4 l Wasser": (4, "l", "Wasser", ""), "½l Wasser": (0.5, "l", "Wasser", ""), "⅛ Liter Sauerrahm": (0.125, "Liter", "Sauerrahm", ""), - "5 Zwiebeln": (5, "", "Zwiebeln", ""), - "3 Zwiebeln, gehackt": (3, "", "Zwiebeln", "gehackt"), - "5 Zwiebeln (gehackt)": (5, "", "Zwiebeln", "gehackt"), - "1 Zwiebel(n)": (1, "", "Zwiebel(n)", ""), - "4 1/2 Zwiebeln": (4.5, "", "Zwiebeln", ""), - "4 ½ Zwiebeln": (4.5, "", "Zwiebeln", ""), + "5 Zwiebeln": (5, None, "Zwiebeln", ""), + "3 Zwiebeln, gehackt": (3, None, "Zwiebeln", "gehackt"), + "5 Zwiebeln (gehackt)": (5, None, "Zwiebeln", "gehackt"), + "1 Zwiebel(n)": (1, None, "Zwiebel(n)", ""), + "4 1/2 Zwiebeln": (4.5, None, "Zwiebeln", ""), + "4 ½ Zwiebeln": (4.5, None, "Zwiebeln", ""), "1/2 EL Mehl": (0.5, "EL", "Mehl", ""), - "1/2 Zwiebel": (0.5, "", "Zwiebel", ""), + "1/2 Zwiebel": (0.5, None, "Zwiebel", ""), "1/5g Mehl, gesiebt": (0.2, "g", "Mehl", "gesiebt"), - "1/2 Zitrone, ausgepresst": (0.5, "", "Zitrone", "ausgepresst"), - "etwas Mehl": (0, "", "etwas Mehl", ""), - "Öl zum Anbraten": (0, "", "Öl zum Anbraten", ""), - "n. B. Knoblauch, zerdrückt": (0, "", "n. B. Knoblauch", "zerdrückt"), + "1/2 Zitrone, ausgepresst": (0.5, None, "Zitrone", "ausgepresst"), + "etwas Mehl": (0, None, "etwas Mehl", ""), + "Öl zum Anbraten": (0, None, "Öl zum Anbraten", ""), + "n. B. Knoblauch, zerdrückt": (0, None, "n. B. Knoblauch", "zerdrückt"), "Kräuter, mediterrane (Oregano, Rosmarin, Basilikum)": ( - 0, "", "Kräuter, mediterrane", "Oregano, Rosmarin, Basilikum"), + 0, None, "Kräuter, mediterrane", "Oregano, Rosmarin, Basilikum"), "600 g Kürbisfleisch (Hokkaido), geschält, entkernt und geraspelt": ( 600, "g", "Kürbisfleisch (Hokkaido)", "geschält, entkernt und geraspelt"), - "Muskat": (0, "", "Muskat", ""), + "Muskat": (0, None, "Muskat", ""), "200 g Mehl, glattes": (200, "g", "Mehl", "glattes"), - "1 Ei(er)": (1, "", "Ei(er)", ""), + "1 Ei(er)": (1, None, "Ei(er)", ""), "1 Prise(n) Salz": (1, "Prise(n)", "Salz", ""), - "etwas Wasser, lauwarmes": (0, "", "etwas Wasser", "lauwarmes"), - "Strudelblätter, fertige, für zwei Strudel": (0, "", "Strudelblätter", "fertige, für zwei Strudel"), - "barrel-aged Bourbon": (0, "", "barrel-aged Bourbon", ""), - "golden syrup": (0, "", "golden syrup", ""), - "unsalted butter, for greasing": (0, "", "unsalted butter", "for greasing"), - "unsalted butter , for greasing": (0, "", "unsalted butter", "for greasing"), # trim + "etwas Wasser, lauwarmes": (0, None, "etwas Wasser", "lauwarmes"), + "Strudelblätter, fertige, für zwei Strudel": (0,None, "Strudelblätter", "fertige, für zwei Strudel"), + "barrel-aged Bourbon": (0, None, "barrel-aged Bourbon", ""), + "golden syrup": (0, None, "golden syrup", ""), + "unsalted butter, for greasing": (0, None, "unsalted butter", "for greasing"), + "unsalted butter , for greasing": (0, None, "unsalted butter", "for greasing"), # trim "1 small sprig of fresh rosemary": (1, "small", "sprig of fresh rosemary", ""), # does not always work perfectly! "75 g fresh breadcrumbs": (75, "g", "fresh breadcrumbs", ""), @@ -49,7 +49,7 @@ def test_ingredient_parser(): "1 Zwiebel gehackt": (1, "Zwiebel", "gehackt", ""), "1 EL Kokosöl": (1, "EL", "Kokosöl", ""), "0.5 paket jäst (à 50 g)": (0.5, "paket", "jäst", "à 50 g"), - "ägg": (0, "", "ägg", ""), + "ägg": (0, None, "ägg", ""), "50 g smör eller margarin": (50, "g", "smör eller margarin", ""), "3,5 l Wasser": (3.5, "l", "Wasser", ""), "3.5 l Wasser": (3.5, "l", "Wasser", ""), @@ -70,4 +70,4 @@ def test_ingredient_parser(): for key, val in expectations.items(): count += 1 parsed = ingredient_parser.parse(key) - assert val == parsed + assert parsed == val diff --git a/cookbook/views/api.py b/cookbook/views/api.py index 15e3cf299..0f1372d2e 100644 --- a/cookbook/views/api.py +++ b/cookbook/views/api.py @@ -1190,6 +1190,11 @@ def recipe_from_source(request): 'error': True, 'msg': _('Connection Refused.') }, status=400) + except requests.exceptions.MissingSchema: + return JsonResponse({ + 'error': True, + 'msg': _('Bad URL Schema.') + }, status=400) recipe_json, recipe_tree, recipe_html, recipe_images = get_recipe_from_source(data, url, request) if len(recipe_tree) == 0 and len(recipe_json) == 0: return JsonResponse({ From b037203b8f214423335ed60ff40ddadb143c5eaa Mon Sep 17 00:00:00 2001 From: Kaibu Date: Sat, 23 Apr 2022 01:28:20 +0200 Subject: [PATCH 03/11] ui improvements (shopping and meal plan) - fixed content scaling for meal plan and shopping - style fixes on shopping list - touch based swipe actions for shopping list - better mobile experience overall --- vue/src/apps/MealPlanView/MealPlanView.vue | 15 +- vue/src/apps/RecipeView/RecipeView.vue | 6 +- .../ShoppingListView/ShoppingListView.vue | 887 +++++++++++------- vue/src/components/MealPlanCard.vue | 6 + vue/src/components/ShoppingLineItem.vue | 182 +++- 5 files changed, 693 insertions(+), 403 deletions(-) diff --git a/vue/src/apps/MealPlanView/MealPlanView.vue b/vue/src/apps/MealPlanView/MealPlanView.vue index 9b0d59b8b..da0ae46d4 100644 --- a/vue/src/apps/MealPlanView/MealPlanView.vue +++ b/vue/src/apps/MealPlanView/MealPlanView.vue @@ -2,7 +2,7 @@
-
+
diff --git a/vue/src/apps/RecipeView/RecipeView.vue b/vue/src/apps/RecipeView/RecipeView.vue index 3250edd9c..bab762da5 100644 --- a/vue/src/apps/RecipeView/RecipeView.vue +++ b/vue/src/apps/RecipeView/RecipeView.vue @@ -233,7 +233,7 @@ export default { this.loadRecipe(window.RECIPE_ID) this.$i18n.locale = window.CUSTOM_LOCALE this.requestWakeLock() - window.addEventListener('resize', this.handleRezise); + window.addEventListener('resize', this.handleResize); }, beforeUnmount() { this.destroyWakeLock() @@ -249,7 +249,7 @@ export default { } } }, - handleRezise: function () { + handleResize: function () { if (document.getElementById('nutrition_container') !== null) { this.ingredient_height = document.getElementById('ingredient_container').clientHeight - document.getElementById('nutrition_container').clientHeight } else { @@ -300,7 +300,7 @@ export default { this.loading = false setTimeout(() => { - this.handleRezise() + this.handleResize() }, 100) }) }, diff --git a/vue/src/apps/ShoppingListView/ShoppingListView.vue b/vue/src/apps/ShoppingListView/ShoppingListView.vue index 12919e80f..2a305bf66 100644 --- a/vue/src/apps/ShoppingListView/ShoppingListView.vue +++ b/vue/src/apps/ShoppingListView/ShoppingListView.vue @@ -1,103 +1,124 @@ + + + + + + {{ $t("Create") }} + + + + - - - -
-
-
- {{ s.name }} - + + +
+
+
+ {{ s.name }} + - - - - - -
-
+ > + + + + + +
+
+
+
+ + + +
+
+
- - - - - - - -
-
- - + + + + + {{ $t("Create") }} + + + + - {{ $t("CategoryInstruction") }} - - - - - -
-
- -
-
-
- {{ categoryName(c) }} - - - -
-
-
-
-
-
-
-
- - - - - -
-
- -
-
-
- {{ categoryName(c) }} - - - -
-
-
-
-
-
-
-
+ + {{ $t("CategoryInstruction") }} + + + + + + +
+
+ +
+
+
+ {{ categoryName(c) }} + + + +
+
+
+
+
+
+
+
+ + + + + +
+
+ +
+
+
+ {{ categoryName(c) }} + + + +
+
+
+
+
+
+
+
+
+
+
+ + - + +
{{ $t("mealplan_autoadd_shopping") }}
- +
@@ -403,7 +517,8 @@
{{ $t("mealplan_autoexclude_onhand") }}
- +
@@ -416,7 +531,8 @@
{{ $t("mealplan_autoinclude_related") }}
- +
@@ -453,7 +569,8 @@
{{ $t("shopping_auto_sync") }}
- +
@@ -466,7 +583,8 @@
{{ $t("shopping_add_onhand") }}
- +
@@ -479,7 +597,8 @@
{{ $t("shopping_recent_days") }}
- +
@@ -492,7 +611,8 @@
{{ $t("filter_to_supermarket") }}
- +
@@ -505,7 +625,8 @@
{{ $t("default_delay") }}
- +
@@ -518,7 +639,7 @@
{{ $t("csv_delim_label") }}
- +
@@ -531,7 +652,7 @@
{{ $t("csv_prefix_label") }}
- +
@@ -544,7 +665,8 @@
{{ $t("left_handed") }}
- +
@@ -561,20 +683,25 @@ -
+
- - - - - + + + + +
@@ -585,23 +712,32 @@ - + - + - + - +
- {{ $t("Reset") }} - {{ $t("Close") }} + {{ + $t("Reset") + }} + + + {{ $t("Close") }} +
@@ -610,7 +746,8 @@ - {{ $t("DelayFor", { hours: delay }) }} + + {{ $t("DelayFor", {hours: delay}) }} - {{ $t("Delete") }} + {{ + $t("Delete") + }} - +