From 0f0e7b78d549ed75f175cbb331b2352b0854f1cf Mon Sep 17 00:00:00 2001 From: Esteban Ordano Date: Wed, 27 Aug 2014 17:19:28 -0300 Subject: [PATCH] remove temporary vars --- js/controllers/send.js | 22 ++++++---------------- views/send.html | 2 +- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/js/controllers/send.js b/js/controllers/send.js index 713bb8b40..2b0041b4c 100644 --- a/js/controllers/send.js +++ b/js/controllers/send.js @@ -6,12 +6,9 @@ angular.module('copayApp.controllers').controller('SendController', $scope.title = 'Send'; $scope.loading = false; var satToUnit = 1 / config.unitToSatoshi; - var configAlternativeToSatoshi = (1 / 512 / 1e-8); - var satToAlternative = 1 / configAlternativeToSatoshi; // TODO: Change $scope.defaultFee = bitcore.TransactionBuilder.FEE_PER_1000B_SAT * satToUnit; $scope.unitToBtc = config.unitToSatoshi / bitcore.util.COIN; $scope.minAmount = config.limits.minAmountSatoshi * satToUnit; - $scope.minAlternativeAmount = config.limits.minAmountSatoshi * satToAlternative; this.alternativeName = config.alternativeName; this.alternativeIsoCode = config.alternativeIsoCode; @@ -19,16 +16,9 @@ angular.module('copayApp.controllers').controller('SendController', $scope._amount = 0; $scope._alternative = 0; - this.amountFilter = function(val) { - if (val) { - return val.toFixed(config.unitDecimals); - } + var makeNumber = function(val) { + return -(-val); }; - this.fiatFilter = function(val) { - if (val) { - return val.toFixed(2); - } - } Object.defineProperty($scope, "alternative", { @@ -38,8 +28,8 @@ angular.module('copayApp.controllers').controller('SendController', set: function (newValue) { this._alternative = newValue; if (typeof(newValue) === 'number') { - this._amount = -(-( - rateService.fromFiat(newValue, config.alternativeIsoCode) * satToUnit + this._amount = makeNumber( + (rateService.fromFiat(newValue, config.alternativeIsoCode) * satToUnit ).toFixed(config.unitDecimals)); } }, @@ -54,8 +44,8 @@ angular.module('copayApp.controllers').controller('SendController', set: function (newValue) { this._amount = newValue; if (newValue) { - this._alternative = -(-( - rateService.toFiat(newValue * config.unitToSatoshi, config.alternativeIsoCode) + this._alternative = makeNumber( + (rateService.toFiat(newValue * config.unitToSatoshi, config.alternativeIsoCode) ).toFixed(2)); } }, diff --git a/views/send.html b/views/send.html index 118558936..2c93546a9 100644 --- a/views/send.html +++ b/views/send.html @@ -90,7 +90,7 @@