Assets forever, rest for defined period

This commit is contained in:
Gwenhael Le Moine 2015-08-04 21:30:39 +02:00
parent aaadc4c741
commit db651168c7

View file

@ -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 ) {