From fa147e74fc3d6a93e69c33bd1a1e364d947aad08 Mon Sep 17 00:00:00 2001 From: Alexis Lahouze Date: Sat, 29 Jul 2017 16:28:59 +0200 Subject: [PATCH] Use account directly to load daily balances. --- src/operations/balanceChart.component.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/operations/balanceChart.component.ts b/src/operations/balanceChart.component.ts index 4c1028f..cff6d46 100644 --- a/src/operations/balanceChart.component.ts +++ b/src/operations/balanceChart.component.ts @@ -35,9 +35,9 @@ export class BalanceChartComponent implements OnInit, OnChanges { ) { } - loadData() { + loadData(account: Account) { this.dailyBalanceService.query( - this.accountIdService.get() + account.id ).subscribe((results) => { var headers: any[][] = [['date', 'balances', 'expenses', 'revenues']]; @@ -148,8 +148,6 @@ export class BalanceChartComponent implements OnInit, OnChanges { } } }); - - this.loadData(); }; setLines(account: Account) { @@ -170,7 +168,8 @@ export class BalanceChartComponent implements OnInit, OnChanges { }; ngOnChanges(changes) { - if('account' in changes) { + if('account' in changes && changes.account.currentValue) { + this.loadData(changes.account.currentValue); this.setLines(changes.account.currentValue); } else { this.setLines(this.account);