mirror of
https://github.com/gwenhael-le-moine/ledgerrb.git
synced 2024-12-26 09:59:18 +01:00
fixes #3
This commit is contained in:
parent
6549a17c95
commit
ff892ddadb
2 changed files with 19 additions and 4 deletions
|
@ -88,9 +88,24 @@ app.controller( 'DashboardCtrl',
|
|||
} );
|
||||
}
|
||||
|
||||
bucket.total = _( bucket.data ).reduce( function ( memo, account ) {
|
||||
return memo + account.amount;
|
||||
}, 0 );
|
||||
bucket.total_detailed = _.chain( bucket.data )
|
||||
.groupBy( function( account ) {
|
||||
return account.account.split(':')[0];
|
||||
} )
|
||||
.each( function( category ) {
|
||||
category.total = _( category ).reduce( function ( memo, account ) {
|
||||
return memo + account.amount;
|
||||
}, 0 );
|
||||
} )
|
||||
.value();
|
||||
bucket.total_detailed = _.chain(bucket.total_detailed)
|
||||
.keys()
|
||||
.map( function( key ) {
|
||||
return { account: key,
|
||||
amount: bucket.total_detailed[key].total };
|
||||
} )
|
||||
.value();
|
||||
|
||||
} );
|
||||
};
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<md-card flex="48" layout="column"
|
||||
data-ng-repeat="bucket in balance.buckets">
|
||||
<md-toolbar>
|
||||
<h3>{{bucket.categories}}, total = {{bucket.total | number:2}} €</h3>
|
||||
<h4 data-ng-repeat="account in bucket.total_detailed">{{account.account}}, total = {{account.amount | number:2}} €</h4>
|
||||
<!-- <md-slider discrete
|
||||
aria-label="score threshold"
|
||||
min="0" max="10" step="1"
|
||||
|
|
Loading…
Reference in a new issue