mirror of
https://github.com/gwenhael-le-moine/credger.git
synced 2024-12-26 09:58:36 +01:00
drop superfluous details
This commit is contained in:
parent
1151b44ee3
commit
1f06a12fe4
1 changed files with 7 additions and 31 deletions
|
@ -72,27 +72,6 @@ ${response.data.values.map(function(transaction) { return format_transaction(tra
|
||||||
ctrl.raw_data = _(response.data)
|
ctrl.raw_data = _(response.data)
|
||||||
.sortBy((account) => { return account.amount; })
|
.sortBy((account) => { return account.amount; })
|
||||||
.reverse();
|
.reverse();
|
||||||
ctrl.raw_total = _(response.data).reduce((memo, account) => { return memo + account.amount; }, 0);
|
|
||||||
|
|
||||||
ctrl.total_detailed = _.chain(ctrl.raw_data)
|
|
||||||
.groupBy((account) => {
|
|
||||||
return account.account.split(':')[0];
|
|
||||||
})
|
|
||||||
.each((category) => {
|
|
||||||
category.total = _(category).reduce((memo, account) => {
|
|
||||||
return memo + account.amount;
|
|
||||||
}, 0);
|
|
||||||
})
|
|
||||||
.value();
|
|
||||||
ctrl.total_detailed = _.chain(ctrl.total_detailed)
|
|
||||||
.keys()
|
|
||||||
.map((key) => {
|
|
||||||
return {
|
|
||||||
account: key,
|
|
||||||
amount: ctrl.total_detailed[key].total
|
|
||||||
};
|
|
||||||
})
|
|
||||||
.value();
|
|
||||||
|
|
||||||
ctrl.graph_options.chart.height = 60 + (25 * ctrl.raw_data.length);
|
ctrl.graph_options.chart.height = 60 + (25 * ctrl.raw_data.length);
|
||||||
|
|
||||||
|
@ -109,17 +88,14 @@ ${response.data.values.map(function(transaction) { return format_transaction(tra
|
||||||
],
|
],
|
||||||
|
|
||||||
template: `
|
template: `
|
||||||
<div class="bucket">
|
<div class="bucket">
|
||||||
<div class="tollbar">
|
<div class="content">
|
||||||
<span ng:repeat="account in $ctrl.total_detailed">{{account.account}} = {{account.amount | number:2}} €</span>
|
<div class="graph">
|
||||||
</div>
|
<nvd3 data="$ctrl.data"
|
||||||
<div class="content">
|
options="$ctrl.graph_options">
|
||||||
<div class="graph">
|
</nvd3>
|
||||||
<nvd3 data="$ctrl.data"
|
|
||||||
options="$ctrl.graph_options">
|
|
||||||
</nvd3>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
`
|
`
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue