diff --git a/public/app/js/controllers/BalanceCtrl.js b/public/app/js/controllers/BalanceCtrl.js index ea956ce4..50ba5397 100644 --- a/public/app/js/controllers/BalanceCtrl.js +++ b/public/app/js/controllers/BalanceCtrl.js @@ -100,6 +100,12 @@ app.controller( 'BalanceCtrl', details: {} }; + API.register( { period: period, + categories: '' } ) + .then( function ( response ) { + $scope.balance.details = _($scope.balance.details).extend( _(response.data.values).groupBy('account') ); + } ); + _($scope.balance.buckets).each( function( bucket ) { API.balance( { period: period, categories: bucket.categories } ) @@ -117,11 +123,6 @@ app.controller( 'BalanceCtrl', return memo + account.amount; }, 0 ); } ); - API.register( { period: period, - categories: bucket.categories } ) - .then( function ( response ) { - $scope.balance.details = _($scope.balance.details).extend( _(response.data.values).groupBy('account') ); - } ); } ); };