sort by asc amount
This commit is contained in:
parent
6e1d36f4f9
commit
bdab7264af
1 changed files with 6 additions and 2 deletions
|
@ -216,7 +216,9 @@ app.controller( 'BalanceCtrl',
|
||||||
+ ( $scope.now.month() + 1 )
|
+ ( $scope.now.month() + 1 )
|
||||||
+ '&categories=Expenses' )
|
+ '&categories=Expenses' )
|
||||||
.then( function( response ) {
|
.then( function( response ) {
|
||||||
$scope.balance.expenses = response.data;
|
$scope.balance.expenses = _(response.data).sortBy( function( account ) {
|
||||||
|
return account.amount;
|
||||||
|
} );
|
||||||
$scope.balance.expenses_total = _(response.data).reduce( function( memo, account ){ return memo + account.amount; }, 0 );
|
$scope.balance.expenses_total = _(response.data).reduce( function( memo, account ){ return memo + account.amount; }, 0 );
|
||||||
} );
|
} );
|
||||||
$http.get( '/api/ledger/balance?period='
|
$http.get( '/api/ledger/balance?period='
|
||||||
|
@ -225,7 +227,9 @@ app.controller( 'BalanceCtrl',
|
||||||
+ ( $scope.now.month() + 1 )
|
+ ( $scope.now.month() + 1 )
|
||||||
+ '&categories=Income' )
|
+ '&categories=Income' )
|
||||||
.then( function( response ) {
|
.then( function( response ) {
|
||||||
$scope.balance.income = response.data;
|
$scope.balance.income = _(response.data).sortBy( function( account ) {
|
||||||
|
return account.amount;
|
||||||
|
} );
|
||||||
$scope.balance.income_total = _(response.data).reduce( function( memo, account ){ return memo + account.amount; }, 0 );
|
$scope.balance.income_total = _(response.data).reduce( function( memo, account ){ return memo + account.amount; }, 0 );
|
||||||
} );
|
} );
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue