From 00b81a7cb95095c08856b6db3c3738a5f6b6ad6a Mon Sep 17 00:00:00 2001 From: tanshu Date: Mon, 13 Feb 2017 10:40:30 +0530 Subject: [PATCH] Fix: Memoize would for some reason would crash instead of updating --- brewman/static/app/ledger/ledger.controller.js | 7 ++----- brewman/static/app/ledger/ledger.html | 8 +++++--- brewman/static/app/recipe/recipe.controller.js | 4 ++-- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/brewman/static/app/ledger/ledger.controller.js b/brewman/static/app/ledger/ledger.controller.js index a33b7ca6..978d6658 100644 --- a/brewman/static/app/ledger/ledger.controller.js +++ b/brewman/static/app/ledger/ledger.controller.js @@ -27,7 +27,6 @@ var LedgerController = ['$scope', '$routeParams', '$location', 'asDateFilter', ' finishDate = $scope.info.FinishDate; if (id === $routeParams.id && startDate === $routeParams.StartDate && finishDate === $routeParams.FinishDate) { Ledger.get({id: id, StartDate: startDate, FinishDate: finishDate}, function (data) { - $scope.doFilter.cache = {}; $scope.info = data; }); } else { @@ -65,7 +64,7 @@ var LedgerController = ['$scope', '$routeParams', '$location', 'asDateFilter', ' $scope.footer = filtered.Footer; }, true); - $scope.doFilter = _.memoize(function (hidden, input) { + $scope.doFilter = function (hidden, input) { var data = angular.copy(input), debit = 0, credit = 0, running = 0; @@ -97,9 +96,7 @@ var LedgerController = ['$scope', '$routeParams', '$location', 'asDateFilter', ' Running: running } }; - }, function (hidden) { - return hidden.sort().join(' '); - }); + }; $scope.shortcuts = { 'up': function (e) { diff --git a/brewman/static/app/ledger/ledger.html b/brewman/static/app/ledger/ledger.html index 6f2bc568..1d29be0d 100644 --- a/brewman/static/app/ledger/ledger.html +++ b/brewman/static/app/ledger/ledger.html @@ -1,4 +1,4 @@ -
+

Ledger

@@ -7,7 +7,8 @@
+ is-open="sdOpen" ng-focus="sdOpen = true" ng-model="info_StartDate" + ng-model-options="{getterSetter: true}"/> @@ -16,7 +17,8 @@
+ is-open="fdOpen" ng-focus="fdOpen = true" ng-model="info_FinishDate" + ng-model-options="{getterSetter: true}"/> diff --git a/brewman/static/app/recipe/recipe.controller.js b/brewman/static/app/recipe/recipe.controller.js index 19198256..4d165702 100644 --- a/brewman/static/app/recipe/recipe.controller.js +++ b/brewman/static/app/recipe/recipe.controller.js @@ -86,7 +86,7 @@ var RecipeListController = ['$scope', 'recipes', '$location', '$routeParams', '$ }); } }, 350); - $scope.doFilter = _.memoize(function (q) { + $scope.doFilter = function (q) { var matches = Tokenizer.parseFilterString(q, $scope.searchInfo), array = angular.copy($scope.info); @@ -95,7 +95,7 @@ var RecipeListController = ['$scope', 'recipes', '$location', '$routeParams', '$ prod.Prices = $scope.subFilter('Prices.', prod.Prices, matches.q, matches.o); }); return array; - }); + }; $scope.subFilter = function (prefix, arr, q, o) { q = angular.copy(q);