feat: Improved Recipe Scaling Support and Shopping List Recipe Refactor (#1847)

* propogate scale changes to print view

* fixed incorrect variable reference

* refactored shopping list recipe routes
cleaned up existing logic
added support for recipe scaling

* updated current revision

* adding to shopping list respects UI recipe scale

* added field annotations

* added tests for recipe scaling

* made column nullable and set to 1 during migration
This commit is contained in:
Michael Genson
2022-12-30 16:47:35 -06:00
committed by GitHub
parent d9c39cc1d0
commit 46cc3898ab
13 changed files with 344 additions and 49 deletions

View File

@@ -199,6 +199,10 @@ export default defineComponent({
required: true,
type: String,
},
recipeScale: {
type: Number,
default: 1,
},
/**
* Optional group ID prop that is only _required_ when the
* public URL is requested. If the public URL button is pressed
@@ -316,7 +320,7 @@ export default defineComponent({
}
async function addRecipeToList(listId: string) {
const { data } = await api.shopping.lists.addRecipe(listId, props.recipeId);
const { data } = await api.shopping.lists.addRecipe(listId, props.recipeId, props.recipeScale);
if (data) {
alert.success(i18n.t("recipe.recipe-added-to-list") as string);
state.shoppingListDialog = false;