diff --git a/public/app/js/controllers/DashboardCtrl.js b/public/app/js/controllers/DashboardCtrl.js index aec93fc8..df2a4b1e 100644 --- a/public/app/js/controllers/DashboardCtrl.js +++ b/public/app/js/controllers/DashboardCtrl.js @@ -115,9 +115,10 @@ app.controller( 'DashboardCtrl', } ); }}; - var Bucket = function( categories ) { + var Bucket = function( categories, period ) { var _this = this; this.categories = categories; + this.period = period; this.score_threshold = 0; this.orderBy = 'amount'; this.orderDesc = false; @@ -130,11 +131,6 @@ app.controller( 'DashboardCtrl', }; }; - $scope.balance = { - buckets: [ new Bucket( 'Expenses Assets Liabilities Income' ) ], - details: {} - }; - $scope.depth = 99; var retrieve_data = function () { var from, to, period; @@ -169,8 +165,14 @@ app.controller( 'DashboardCtrl', // $scope.total_unbudgeted = _($scope.budget).findWhere( { percentage: -1 } ).amount; // } ); + $scope.balance = { + buckets: [ new Bucket( 'Expenses Liabilities Equity Income', period ), + new Bucket( 'Assets', null ) ], + details: {} + }; + _($scope.balance.buckets).each( function( bucket ) { - API.balance( { period: period, + API.balance( { period: bucket.period, categories: bucket.categories, depth: $scope.depth } ) .then( function ( response ) {