diff --git a/js/app.js b/js/app.js index 52f4a53..2b6901f 100644 --- a/js/app.js +++ b/js/app.js @@ -34,7 +34,7 @@ document.addEventListener('DOMContentLoaded', function(){ currentDrink = addRecipe(currentDrink, dataValue); break; case "SYRUP": - currentDrink = addSyrup(currentDrink, dataValue); + Object.assign(currentDrink.recipe, addSyrup(currentDrink.recipe, dataValue, currentDrink.size)); break; case "CONTROL": changeMenu(dataValue); diff --git a/js/createDrink.js b/js/createDrink.js index 29a2f80..2c7ef9d 100644 --- a/js/createDrink.js +++ b/js/createDrink.js @@ -137,14 +137,17 @@ function addRecipe(drink, recipe){ return drink; } -function addSyrup(drink, syrup, qunatity){ +function addSyrup(recipe, syrup, size, qunatity){ let pumps = 0; if(qunatity){ pumps = qunatity } + else if(size){ + pumps = standardPumps(size); + } else{ - pumps = standardPumps(drink.size); + pumps = 1; } s = { @@ -152,14 +155,14 @@ function addSyrup(drink, syrup, qunatity){ count: pumps } - let otherSyrups = _.without(drink.recipe.addedSyrups, _.findWhere(drink.recipe.addedSyrups, { + let otherSyrups = _.without(recipe.addedSyrups, _.findWhere(recipe.addedSyrups, { name: syrup })); otherSyrups.push(s); - drink.recipe.addedSyrups = otherSyrups; + recipe.addedSyrups = otherSyrups; - return drink; + return recipe; } function standardPumps(size, mod){ diff --git a/js/standardRecipies.js b/js/standardRecipies.js index dc0c8c8..2fadae1 100644 --- a/js/standardRecipies.js +++ b/js/standardRecipies.js @@ -1,3 +1,62 @@ +function americano (drink) { + let recipe = { + name: "Americano", + assigned: true, + shots: standardShots(drink.size, 1), + milk: milkTypes.TWOPERCENT + } + return recipe; + } + + function espresso (drink) { + let recipe = { + name: "Espresso", + assigned: true + } + return recipe; + } + +function espressoMacchiato (drink) { + let recipe = { + name: "Espresso Macchiato", + assigned: true, + shots: standardShots(drink.size), + milk: milkTypes.TWOPERCENT + } + return recipe; + } + + function espressoConPanna (drink) { + let recipe = { + name: "Espresso Macchiato", + assigned: true, + milk: milkTypes.TWOPERCENT + } + return recipe; + } + + function starbucksDoubleShotOnIce (drink) { + let recipe = { + name: "Starbucks Double Shot On Ice", + assigned: true, + shots: shotsSBDS(), + milk: milkTypes.TWOPERCENT + } + function shotsSBDS(){ + switch (drink.size){ + case drinkSizes.TALL: + return 2; + case drinkSizes.GRANDE: + return 3; + case drinkSizes.VENTI: + return 5; + default: + return 0; + } + } + return recipe; + } + function latte (drink) { let recipe = { name: "Latte", @@ -8,6 +67,17 @@ function latte (drink) { return recipe; } +function cinnamonDolceLatte (drink) { + let recipe = { + name: "Cinnamon Dolce Latte", + assigned: true, + shots: standardShots(drink.size), + milk: milkTypes.TWOPERCENT + } + addSyrup(drink, "Cinnamon Dolce") + return recipe; + } + function skinnyLatte (drink) { let recipe = { name: "Skinny Syrup Latte",