-
-
Save bangpound/f118cd62f8155356572bdd4399ed1bea to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/app/controllers/accountForm.controller.js b/src/app/controllers/accountForm.controller.js | |
index 96f64ce..303813c 100644 | |
--- a/src/app/controllers/accountForm.controller.js | |
+++ b/src/app/controllers/accountForm.controller.js | |
@@ -1,5 +1,5 @@ | |
export class AccountFormController { | |
- constructor ($log, HateoasResource, Account, $uibModalInstance, account, action, $scope) { | |
+ constructor ($log, HateoasResource, Account, $uibModalInstance, account, action, currentLedger, $scope) { | |
'ngInject'; | |
// Services and resources | |
@@ -12,7 +12,7 @@ export class AccountFormController { | |
this.newLedger = this.getNewLedger(); | |
this.currentAccount = account || {}; | |
this.action = action; | |
- this.currentLedger = $scope.accounts.getViewedLedger(account); | |
+ this.currentLedger = currentLedger; | |
this.viewingCurrentMonth = $scope.accounts.viewingCurrentMonth(); | |
this.accountType = $scope.accounts.accountType; | |
this.categories = $scope.accounts.categories; | |
diff --git a/src/app/controllers/accounts.controller.js b/src/app/controllers/accounts.controller.js | |
index bca43c8..581d9cb 100644 | |
--- a/src/app/controllers/accounts.controller.js | |
+++ b/src/app/controllers/accounts.controller.js | |
@@ -71,7 +71,8 @@ export class AccountsController { | |
} | |
getViewedLedger(account) { | |
- return this.viewedLedgers[this.accounts.indexOf(account)]; | |
+ let ledger = this.viewedLedgers[this.accounts.indexOf(account)]; | |
+ return ledger; | |
} | |
openModal(action, account) { | |
@@ -95,9 +96,15 @@ export class AccountsController { | |
Account: () => { | |
return Account; | |
}, | |
- account: () => { | |
+ account: (account) => { | |
+ account.interest_rate = account.interest_rate * 100; | |
return account; | |
}, | |
+ currentLedger: (account) => { | |
+ let ledger = this.getViewedLedger(account); | |
+ ledger.balance = Math.abs(ledger.balance); | |
+ return ledger; | |
+ }, | |
action: () => { | |
return action; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment