mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-01 04:10:06 -05:00
Use serving count in shopping list
This commit is contained in:
@@ -577,7 +577,7 @@
|
|||||||
id: Math.round(Math.random() * 1000) + 10000,
|
id: Math.round(Math.random() * 1000) + 10000,
|
||||||
recipe: recipe.id,
|
recipe: recipe.id,
|
||||||
recipe_name: recipe.name,
|
recipe_name: recipe.name,
|
||||||
recipe_multiplier: (this.new_note_multiplier > 1) ? this.new_note_multiplier : 1,
|
recipe_multiplier: (this.new_note_multiplier > 1) ? this.new_note_multiplier : recipe.servings,
|
||||||
title: this.new_note_title,
|
title: this.new_note_title,
|
||||||
note: this.new_note_text,
|
note: this.new_note_text,
|
||||||
is_new: true
|
is_new: true
|
||||||
|
|||||||
@@ -349,7 +349,12 @@
|
|||||||
multiplier_cache() {
|
multiplier_cache() {
|
||||||
let cache = {}
|
let cache = {}
|
||||||
this.shopping_list.recipes.forEach((r) => {
|
this.shopping_list.recipes.forEach((r) => {
|
||||||
cache[r.id] = !(Number.isNaN(r.multiplier)) ? parseFloat(r.multiplier) : 1
|
let multiplier = r.servings;
|
||||||
|
if(!Number.isNaN(r.multiplier)){
|
||||||
|
multiplier = parseFloat(r.multiplier)
|
||||||
|
}
|
||||||
|
cache[r.id] = multiplier / r.servings;
|
||||||
|
|
||||||
})
|
})
|
||||||
return cache
|
return cache
|
||||||
},
|
},
|
||||||
@@ -621,7 +626,8 @@
|
|||||||
"id": Math.random() * 1000,
|
"id": Math.random() * 1000,
|
||||||
"recipe": recipe.id,
|
"recipe": recipe.id,
|
||||||
"recipe_name": recipe.name,
|
"recipe_name": recipe.name,
|
||||||
"multiplier": multiplier
|
"multiplier": multiplier,
|
||||||
|
"servings": recipe.servings,
|
||||||
}
|
}
|
||||||
|
|
||||||
this.shopping_list.recipes.push(slr)
|
this.shopping_list.recipes.push(slr)
|
||||||
|
|||||||
Reference in New Issue
Block a user