mirror of
https://github.com/gwenhael-le-moine/ledgerrb.git
synced 2025-01-27 07:58:31 +01:00
one less API call
This commit is contained in:
parent
f73a3d20ef
commit
475a770ea3
1 changed files with 6 additions and 5 deletions
|
@ -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') );
|
||||
} );
|
||||
} );
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue