From 968a79335c0af2cf0bbee3d770875ef99d54b7fa Mon Sep 17 00:00:00 2001 From: Joshua Shoemaker Date: Mon, 30 Jan 2017 21:43:49 -0600 Subject: [PATCH] refactor: seperated addedSyrups from standard --- js/createDrink.js | 7 ++++--- js/order.js | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/js/createDrink.js b/js/createDrink.js index 02ff7f6..147ddc6 100644 --- a/js/createDrink.js +++ b/js/createDrink.js @@ -8,8 +8,9 @@ function createDrink(){ assigned: false, shotType: shotTypes.NORMAL, syrups: [], + addedSyrups: [], milk: milkTypes.NONE - } + }, } } @@ -139,12 +140,12 @@ function addSyrup(drink, syrup, qunatity){ count: pumps } - let otherSyrups = _.without(drink.recipe.syrups, _.findWhere(drink.recipe.syrups, { + let otherSyrups = _.without(drink.recipe.addedSyrups, _.findWhere(drink.recipe.addedSyrups, { name: syrup })); otherSyrups.push(s); - drink.recipe.syrups = otherSyrups; + drink.recipe.addedSyrups = otherSyrups; return drink; } diff --git a/js/order.js b/js/order.js index fed10c0..c4d2547 100644 --- a/js/order.js +++ b/js/order.js @@ -80,8 +80,8 @@ function orderDisplay(drink){ o.caffeine = "" } - if(drink.recipe.syrups.length > 0){ - drink.recipe.syrups.forEach(function(e) { + if(drink.recipe.addedSyrups.length > 0){ + drink.recipe.addedSyrups.forEach(function(e) { o.syrups += e.name + "
" }, this); }