From 3db55cd82b482610b512a7c3cff2ee332a605a37 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Fri, 11 Feb 2022 14:16:22 +0100 Subject: [PATCH 01/16] added sub path nginx example --- docs/install/docker.md | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/docs/install/docker.md b/docs/install/docker.md index 233e05a63..b8ed504eb 100644 --- a/docs/install/docker.md +++ b/docs/install/docker.md @@ -347,4 +347,35 @@ follow these instructions: - Delete local database folder (usually 'postgresql' in the same folder as your 'docker-compose.yml' file) - Start Tandoor containers again (`docker-compose up -d`) - Wait for at least 2-3 minutes and then check if everything is working now (migrations can take quite some time!) -- If not, check logs of the web_recipes container with `docker logs ` and make sure that all migrations are indeed already done \ No newline at end of file +- If not, check logs of the web_recipes container with `docker logs ` and make sure that all migrations are indeed already done + +### Sub Path nginx config + +If hosting under a sub-path you might want to change the default nginx config (which gets mounted through the named volume from the application container into the nginx container) +with the following config. + +``` +location /my_app { # change to subfolder name + include /config/nginx/proxy.conf; + proxy_pass https://mywebapp.com/; # change to your host name:port + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Script-Name /my_app; # change to subfolder name + proxy_cookie_path / /my_app; # change to subfolder name +} + +location /media/ { + include /config/nginx/proxy.conf; + alias /mediafiles/; + client_max_body_size 16M; + +} + + +location /static/ { + include /config/nginx/proxy.conf; + alias /staticfiles/; + client_max_body_size 16M; + +} +``` \ No newline at end of file From c0b43987dd270cbdad2c1758e89a9dabd81386f8 Mon Sep 17 00:00:00 2001 From: MaxJa4 <74194322+MaxJa4@users.noreply.github.com> Date: Mon, 14 Feb 2022 16:13:16 +0100 Subject: [PATCH 02/16] Added extistence check for nginx config file. --- boot.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/boot.sh b/boot.sh index 1a6cdb521..52fdff04b 100644 --- a/boot.sh +++ b/boot.sh @@ -1,8 +1,15 @@ #!/bin/sh source venv/bin/activate - TANDOOR_PORT="${TANDOOR_PORT:-8080}" +NGINX_CONF_FILE=/opt/recipes/nginx/conf.d/Recipes.conf + +echo "Checking configuration..." + +if [ ! -f "$NGINX_CONF_FILE" ]; then + echo -e "\n[WARNING]\nNginx configuration file could not be found at the default location!" + echo -e "Path: ${NGINX_CONF_FILE}\n" +fi echo "Waiting for database to be ready..." From c90de725b0a80dbbf291463e1b16e84d7b97d242 Mon Sep 17 00:00:00 2001 From: MaxJa4 <74194322+MaxJa4@users.noreply.github.com> Date: Mon, 14 Feb 2022 16:16:45 +0100 Subject: [PATCH 03/16] Only show warning if not using gunicorn --- boot.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boot.sh b/boot.sh index 52fdff04b..f8625d873 100644 --- a/boot.sh +++ b/boot.sh @@ -6,7 +6,7 @@ NGINX_CONF_FILE=/opt/recipes/nginx/conf.d/Recipes.conf echo "Checking configuration..." -if [ ! -f "$NGINX_CONF_FILE" ]; then +if [ ! -f "$NGINX_CONF_FILE" ] && [ $GUNICORN_MEDIA -ne 1 ]; then echo -e "\n[WARNING]\nNginx configuration file could not be found at the default location!" echo -e "Path: ${NGINX_CONF_FILE}\n" fi From b9f16c3f667e8b1a0c9c03ae4fee1dc37f919c97 Mon Sep 17 00:00:00 2001 From: MaxJa4 <74194322+MaxJa4@users.noreply.github.com> Date: Mon, 14 Feb 2022 16:45:37 +0100 Subject: [PATCH 04/16] Inverted truth check for GUNICORN_MEDIA --- boot.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boot.sh b/boot.sh index f8625d873..91b436f78 100644 --- a/boot.sh +++ b/boot.sh @@ -6,7 +6,7 @@ NGINX_CONF_FILE=/opt/recipes/nginx/conf.d/Recipes.conf echo "Checking configuration..." -if [ ! -f "$NGINX_CONF_FILE" ] && [ $GUNICORN_MEDIA -ne 1 ]; then +if [ ! -f "$NGINX_CONF_FILE" ] && [ $GUNICORN_MEDIA -eq 0 ]; then echo -e "\n[WARNING]\nNginx configuration file could not be found at the default location!" echo -e "Path: ${NGINX_CONF_FILE}\n" fi From 19708dbc64a18e00ffd45a6210d38008f0464b80 Mon Sep 17 00:00:00 2001 From: smilerz Date: Mon, 14 Feb 2022 17:28:16 -0600 Subject: [PATCH 05/16] paste list of ingredients --- cookbook/views/views.py | 1 + .../apps/RecipeEditView/RecipeEditView.vue | 44 ++++++++++++++++++- vue/src/locales/en.json | 5 ++- 3 files changed, 48 insertions(+), 2 deletions(-) diff --git a/cookbook/views/views.py b/cookbook/views/views.py index 8a1462a25..6fefc11ab 100644 --- a/cookbook/views/views.py +++ b/cookbook/views/views.py @@ -12,6 +12,7 @@ from django.contrib.auth.models import Group from django.contrib.auth.password_validation import validate_password from django.core.exceptions import ValidationError from django.db.models import Avg, Q, Sum +from django.db.models.functions import Lower from django.http import HttpResponseRedirect, JsonResponse from django.shortcuts import get_object_or_404, redirect, render from django.urls import reverse, reverse_lazy diff --git a/vue/src/apps/RecipeEditView/RecipeEditView.vue b/vue/src/apps/RecipeEditView/RecipeEditView.vue index 0bd118fa6..771cef262 100644 --- a/vue/src/apps/RecipeEditView/RecipeEditView.vue +++ b/vue/src/apps/RecipeEditView/RecipeEditView.vue @@ -210,6 +210,18 @@ {{ $t("File") }} + + {{ $t("paste_ingredients") }} + @@ -516,6 +528,17 @@ + + + + + @@ -574,7 +597,8 @@ export default { recipes_loading: false, message: "", options_limit: 25, - + paste_ingredients: undefined, + paste_step: undefined, show_file_create: false, step_for_file_create: undefined, } @@ -942,6 +966,24 @@ export default { energy: function () { return energyHeading() }, + appendIngredients: function () { + let ing_list = this.paste_ingredients.split(/\r?\n/) + let step = this.recipe.steps.findIndex((x) => x.id == this.paste_step) + this.recipe.steps[step].ingredients_visible = true + ing_list.forEach((ing) => { + this.genericPostAPI("api_ingredient_from_string", { text: ing }).then((result) => { + let unit = null + if (result.data.unit !== "") { + unit = { name: result.data.unit } + } + this.recipe.steps[step].ingredients.push({ + amount: result.data.amount, + unit: unit, + food: { name: result.data.food }, + }) + }) + }) + }, }, } diff --git a/vue/src/locales/en.json b/vue/src/locales/en.json index 9bf72a48c..8942d03e6 100644 --- a/vue/src/locales/en.json +++ b/vue/src/locales/en.json @@ -296,5 +296,8 @@ "food_recipe_help": "Linking a recipe here will include the linked recipe in any other recipe that use this food", "Foods": "Foods", "review_shopping": "Review shopping entries before saving", - "view_recipe": "View Recipe" + "view_recipe": "View Recipe", + "paste_ingredients_placeholder": "Paste ingredient list here...", + "paste_ingredients": "Paste Ingredients", + "ingredient_list": "Ingredient List" } From 57658e76f5feda8e360ab4cec7297cd2065bfbc3 Mon Sep 17 00:00:00 2001 From: smilerz Date: Mon, 14 Feb 2022 17:47:17 -0600 Subject: [PATCH 06/16] fix duplicate shopping recipes when auto-add enabled --- cookbook/views/views.py | 1 + vue/src/components/MealPlanEditModal.vue | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cookbook/views/views.py b/cookbook/views/views.py index 8a1462a25..6fefc11ab 100644 --- a/cookbook/views/views.py +++ b/cookbook/views/views.py @@ -12,6 +12,7 @@ from django.contrib.auth.models import Group from django.contrib.auth.password_validation import validate_password from django.core.exceptions import ValidationError from django.db.models import Avg, Q, Sum +from django.db.models.functions import Lower from django.http import HttpResponseRedirect, JsonResponse from django.shortcuts import get_object_or_404, redirect, render from django.urls import reverse, reverse_lazy diff --git a/vue/src/components/MealPlanEditModal.vue b/vue/src/components/MealPlanEditModal.vue index cb1d72434..0dc944225 100644 --- a/vue/src/components/MealPlanEditModal.vue +++ b/vue/src/components/MealPlanEditModal.vue @@ -207,8 +207,7 @@ export default { if (!cancel) { console.log("saving", { ...this.mealplan_settings, ...this.entryEditing }) this.$bvModal.hide(`edit-modal`) - this.$emit("save-entry", { ...this.mealplan_settings, ...this.entryEditing }) - console.log("after emit", { ...this.mealplan_settings, ...this.entryEditing }.addshopping) + this.$emit("save-entry", { ...this.mealplan_settings, ...this.entryEditing, ...{ addshopping: this.entryEditing.addshopping && !this.autoMealPlan } }) } }, deleteEntry() { From 90b4ecb5993f93d8982c9f0a2af999281c71f6b9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 15 Feb 2022 02:38:12 +0000 Subject: [PATCH 07/16] Bump follow-redirects from 1.14.7 to 1.14.8 in /vue Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.14.7 to 1.14.8. - [Release notes](https://github.com/follow-redirects/follow-redirects/releases) - [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.14.7...v1.14.8) --- updated-dependencies: - dependency-name: follow-redirects dependency-type: indirect ... Signed-off-by: dependabot[bot] --- vue/yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vue/yarn.lock b/vue/yarn.lock index a3ed32e1f..f34632674 100644 --- a/vue/yarn.lock +++ b/vue/yarn.lock @@ -5369,9 +5369,9 @@ flush-write-stream@^1.0.0: readable-stream "^2.3.6" follow-redirects@^1.0.0, follow-redirects@^1.14.4: - version "1.14.7" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.7.tgz#2004c02eb9436eee9a21446a6477debf17e81685" - integrity sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ== + version "1.14.8" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.8.tgz#016996fb9a11a100566398b1c6839337d7bfa8fc" + integrity sha512-1x0S9UVJHsQprFcEC/qnNzBLcIxsjAV905f/UkQxbclCsoTWlacCNOpQa/anodLl2uaEKFhfWOvM2Qg77+15zA== for-in@^1.0.2: version "1.0.2" From ad6d99800e14c9170acf88d25e59fb1b2588981b Mon Sep 17 00:00:00 2001 From: smilerz Date: Wed, 16 Feb 2022 08:35:04 -0600 Subject: [PATCH 08/16] include note from ingredient API --- vue/src/apps/RecipeEditView/RecipeEditView.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/vue/src/apps/RecipeEditView/RecipeEditView.vue b/vue/src/apps/RecipeEditView/RecipeEditView.vue index 771cef262..874acdd98 100644 --- a/vue/src/apps/RecipeEditView/RecipeEditView.vue +++ b/vue/src/apps/RecipeEditView/RecipeEditView.vue @@ -980,6 +980,7 @@ export default { amount: result.data.amount, unit: unit, food: { name: result.data.food }, + note: result.data.note, }) }) }) From 501f56ffd5d2920dd7781526ee938c6c8927ca1f Mon Sep 17 00:00:00 2001 From: smilerz Date: Wed, 16 Feb 2022 09:16:51 -0600 Subject: [PATCH 09/16] copy to new recipe --- vue/src/components/RecipeContextMenu.vue | 19 +++++++++++++++++++ vue/src/locales/en.json | 4 +++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/vue/src/components/RecipeContextMenu.vue b/vue/src/components/RecipeContextMenu.vue index 1bd7531ec..ce2bbfb89 100644 --- a/vue/src/components/RecipeContextMenu.vue +++ b/vue/src/components/RecipeContextMenu.vue @@ -31,6 +31,9 @@ {{ $t("Print") }} + + + {{ $t("Export") }} @@ -202,6 +205,22 @@ export default { addToShopping() { this.$bvModal.show(`shopping_${this.modal_id}`) }, + copyToNew: function () { + let recipename = window.prompt(this.$t("copy_to_new"), this.$t("recipe_name")) + let apiClient = new ApiApiFactory() + apiClient.retrieveRecipe(this.recipe.id).then((results) => { + apiClient + .createRecipe({ ...results.data, ...{ id: undefined, name: recipename } }) + .then((newrecipe) => { + console.log(newrecipe.data, this.resolveDjangoUrl("view_recipe", newrecipe.data.id)) + StandardToasts.makeStandardToast(StandardToasts.SUCCESS_CREATE) + window.open(this.resolveDjangoUrl("view_recipe", newrecipe.data.id)) + }) + .catch((error) => { + StandardToasts.makeStandardToast(StandardToasts.FAIL_CREATE) + }) + }) + }, }, } diff --git a/vue/src/locales/en.json b/vue/src/locales/en.json index 9bf72a48c..d941bfef3 100644 --- a/vue/src/locales/en.json +++ b/vue/src/locales/en.json @@ -296,5 +296,7 @@ "food_recipe_help": "Linking a recipe here will include the linked recipe in any other recipe that use this food", "Foods": "Foods", "review_shopping": "Review shopping entries before saving", - "view_recipe": "View Recipe" + "view_recipe": "View Recipe", + "copy_to_new": "Copy To New Recipe", + "recipe_name": "Recipe Name" } From 42a6f8457ae7db502fcc85300e53fbc555cbad10 Mon Sep 17 00:00:00 2001 From: smilerz Date: Wed, 16 Feb 2022 10:58:05 -0600 Subject: [PATCH 10/16] remove console messages --- vue/src/components/RecipeContextMenu.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/vue/src/components/RecipeContextMenu.vue b/vue/src/components/RecipeContextMenu.vue index ce2bbfb89..ff7803162 100644 --- a/vue/src/components/RecipeContextMenu.vue +++ b/vue/src/components/RecipeContextMenu.vue @@ -212,7 +212,6 @@ export default { apiClient .createRecipe({ ...results.data, ...{ id: undefined, name: recipename } }) .then((newrecipe) => { - console.log(newrecipe.data, this.resolveDjangoUrl("view_recipe", newrecipe.data.id)) StandardToasts.makeStandardToast(StandardToasts.SUCCESS_CREATE) window.open(this.resolveDjangoUrl("view_recipe", newrecipe.data.id)) }) From 539578c9658b6908100da0980e7bb8b67d140b65 Mon Sep 17 00:00:00 2001 From: MaxJa4 <74194322+MaxJa4@users.noreply.github.com> Date: Wed, 16 Feb 2022 18:57:25 +0100 Subject: [PATCH 11/16] Add check for SECRET_KEY and POSTGRES_PASSWORD --- boot.sh | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/boot.sh b/boot.sh index 91b436f78..313fbd42d 100644 --- a/boot.sh +++ b/boot.sh @@ -4,11 +4,26 @@ source venv/bin/activate TANDOOR_PORT="${TANDOOR_PORT:-8080}" NGINX_CONF_FILE=/opt/recipes/nginx/conf.d/Recipes.conf +display_warning() { + echo "[WARNING]" + echo -e "$1" +} + echo "Checking configuration..." +# Nginx config file must exist if gunicorn is not active if [ ! -f "$NGINX_CONF_FILE" ] && [ $GUNICORN_MEDIA -eq 0 ]; then - echo -e "\n[WARNING]\nNginx configuration file could not be found at the default location!" - echo -e "Path: ${NGINX_CONF_FILE}\n" + display_warning "Nginx configuration file could not be found at the default location!\nPath: ${NGINX_CONF_FILE}" +fi + +# SECRET_KEY must be set in .env file +if [ -z "${SECRET_KEY}" ]; then + display_warning "The environment variable 'SECRET_KEY' is not set but REQUIRED for running Tandoor!" +fi + +# POSTGRES_PASSWORD must be set in .env file +if [ -z "${POSTGRES_PASSWORD}" ]; then + display_warning "The environment variable 'POSTGRES_PASSWORD' is not set but REQUIRED for running Tandoor!" fi echo "Waiting for database to be ready..." @@ -43,4 +58,4 @@ echo "Done" chmod -R 755 /opt/recipes/mediafiles -exec gunicorn -b :$TANDOOR_PORT --access-logfile - --error-logfile - --log-level INFO recipes.wsgi +exec gunicorn -b :$TANDOOR_PORT --access-logfile - --error-logfile - --log-level INFO recipes.wsgi \ No newline at end of file From 8b94bf1333b794660035adefbe384635c24dbec1 Mon Sep 17 00:00:00 2001 From: smilerz Date: Wed, 16 Feb 2022 13:22:53 -0600 Subject: [PATCH 12/16] retain order of pasted ingredients --- vue/src/apps/RecipeEditView/RecipeEditView.vue | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vue/src/apps/RecipeEditView/RecipeEditView.vue b/vue/src/apps/RecipeEditView/RecipeEditView.vue index 874acdd98..1eb9c4949 100644 --- a/vue/src/apps/RecipeEditView/RecipeEditView.vue +++ b/vue/src/apps/RecipeEditView/RecipeEditView.vue @@ -969,6 +969,7 @@ export default { appendIngredients: function () { let ing_list = this.paste_ingredients.split(/\r?\n/) let step = this.recipe.steps.findIndex((x) => x.id == this.paste_step) + let order = 0 this.recipe.steps[step].ingredients_visible = true ing_list.forEach((ing) => { this.genericPostAPI("api_ingredient_from_string", { text: ing }).then((result) => { @@ -981,8 +982,10 @@ export default { unit: unit, food: { name: result.data.food }, note: result.data.note, + order: order, }) }) + order++ }) }, }, From d68a89a32ca808cad36d51823c8118637ed16e01 Mon Sep 17 00:00:00 2001 From: smilerz Date: Wed, 16 Feb 2022 14:07:56 -0600 Subject: [PATCH 13/16] catch empty lines in paste_ingredients --- .../apps/RecipeEditView/RecipeEditView.vue | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/vue/src/apps/RecipeEditView/RecipeEditView.vue b/vue/src/apps/RecipeEditView/RecipeEditView.vue index 1eb9c4949..973b57689 100644 --- a/vue/src/apps/RecipeEditView/RecipeEditView.vue +++ b/vue/src/apps/RecipeEditView/RecipeEditView.vue @@ -969,23 +969,24 @@ export default { appendIngredients: function () { let ing_list = this.paste_ingredients.split(/\r?\n/) let step = this.recipe.steps.findIndex((x) => x.id == this.paste_step) - let order = 0 + let order = Math.max(...this.recipe.steps[step].ingredients.map((x) => x.order)) + 1 this.recipe.steps[step].ingredients_visible = true ing_list.forEach((ing) => { - this.genericPostAPI("api_ingredient_from_string", { text: ing }).then((result) => { - let unit = null - if (result.data.unit !== "") { - unit = { name: result.data.unit } - } - this.recipe.steps[step].ingredients.push({ - amount: result.data.amount, - unit: unit, - food: { name: result.data.food }, - note: result.data.note, - order: order, + if (ing.trim() !== "") { + this.genericPostAPI("api_ingredient_from_string", { text: ing }).then((result) => { + let unit = null + if (result.data.unit !== "") { + unit = { name: result.data.unit } + } + this.recipe.steps[step].ingredients.splice(order, 0, { + amount: result.data.amount, + unit: unit, + food: { name: result.data.food }, + note: result.data.note, + }) }) - }) - order++ + order++ + } }) }, }, From 57dec86b0629949a5997a115be33b5a163549d9f Mon Sep 17 00:00:00 2001 From: smilerz Date: Wed, 16 Feb 2022 14:17:41 -0600 Subject: [PATCH 14/16] handle empty ingredient list when pasting --- vue/src/apps/RecipeEditView/RecipeEditView.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vue/src/apps/RecipeEditView/RecipeEditView.vue b/vue/src/apps/RecipeEditView/RecipeEditView.vue index 973b57689..e644924c6 100644 --- a/vue/src/apps/RecipeEditView/RecipeEditView.vue +++ b/vue/src/apps/RecipeEditView/RecipeEditView.vue @@ -969,7 +969,7 @@ export default { appendIngredients: function () { let ing_list = this.paste_ingredients.split(/\r?\n/) let step = this.recipe.steps.findIndex((x) => x.id == this.paste_step) - let order = Math.max(...this.recipe.steps[step].ingredients.map((x) => x.order)) + 1 + let order = Math.max(...(this.recipe.steps[step].ingredients.map((x) => x.order), 0)) + 1 this.recipe.steps[step].ingredients_visible = true ing_list.forEach((ing) => { if (ing.trim() !== "") { From 5f3d5afc37afba88e45a2c3c5c54f6fcefbae9a3 Mon Sep 17 00:00:00 2001 From: smilerz Date: Wed, 16 Feb 2022 14:18:23 -0600 Subject: [PATCH 15/16] typo --- vue/src/apps/RecipeEditView/RecipeEditView.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vue/src/apps/RecipeEditView/RecipeEditView.vue b/vue/src/apps/RecipeEditView/RecipeEditView.vue index e644924c6..d005853e8 100644 --- a/vue/src/apps/RecipeEditView/RecipeEditView.vue +++ b/vue/src/apps/RecipeEditView/RecipeEditView.vue @@ -969,7 +969,7 @@ export default { appendIngredients: function () { let ing_list = this.paste_ingredients.split(/\r?\n/) let step = this.recipe.steps.findIndex((x) => x.id == this.paste_step) - let order = Math.max(...(this.recipe.steps[step].ingredients.map((x) => x.order), 0)) + 1 + let order = Math.max(...this.recipe.steps[step].ingredients.map((x) => x.order), 0) + 1 this.recipe.steps[step].ingredients_visible = true ing_list.forEach((ing) => { if (ing.trim() !== "") { From 21c6f819a0c452b01541e4c1bcabfaf27454e477 Mon Sep 17 00:00:00 2001 From: smilerz Date: Wed, 16 Feb 2022 14:19:58 -0600 Subject: [PATCH 16/16] start counting at zero --- vue/src/apps/RecipeEditView/RecipeEditView.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vue/src/apps/RecipeEditView/RecipeEditView.vue b/vue/src/apps/RecipeEditView/RecipeEditView.vue index d005853e8..14ccd0c3f 100644 --- a/vue/src/apps/RecipeEditView/RecipeEditView.vue +++ b/vue/src/apps/RecipeEditView/RecipeEditView.vue @@ -969,7 +969,7 @@ export default { appendIngredients: function () { let ing_list = this.paste_ingredients.split(/\r?\n/) let step = this.recipe.steps.findIndex((x) => x.id == this.paste_step) - let order = Math.max(...this.recipe.steps[step].ingredients.map((x) => x.order), 0) + 1 + let order = Math.max(...this.recipe.steps[step].ingredients.map((x) => x.order), -1) + 1 this.recipe.steps[step].ingredients_visible = true ing_list.forEach((ing) => { if (ing.trim() !== "") {