From 9e59dead07b12ebc38508f1d81d29f9749c3bf3d Mon Sep 17 00:00:00 2001 From: Rohan Mitchell Date: Fri, 11 Jan 2013 15:52:45 +1100 Subject: [PATCH] Tidy up coffee --- .../javascripts/admin/order_cycle.js.erb.coffee | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/app/assets/javascripts/admin/order_cycle.js.erb.coffee b/app/assets/javascripts/admin/order_cycle.js.erb.coffee index d8cbc4b3ea..2362e02637 100644 --- a/app/assets/javascripts/admin/order_cycle.js.erb.coffee +++ b/app/assets/javascripts/admin/order_cycle.js.erb.coffee @@ -62,14 +62,9 @@ app.factory 'OrderCycle', ($resource, $window) -> outgoing_exchanges: [] exchangeSelectedVariants: (exchange) -> - numActiveVariants = 0; - - # TODO: Functionalise - angular.forEach exchange.variants, (active, id) -> - if(active) - numActiveVariants++ - - numActiveVariants + numActiveVariants = 0 + numActiveVariants++ for id, active of exchange.variants when active + numActiveVariants toggleProducts: (exchange) -> exchange.showProducts = !exchange.showProducts @@ -100,7 +95,7 @@ app.factory 'OrderCycle', ($resource, $window) -> delete(service.order_cycle.exchanges) - this.order_cycle; + this.order_cycle create: -> this.removeInactiveExchanges()