From d074a7da7f7ad2666c22249bb9cef0af6621fd7e Mon Sep 17 00:00:00 2001 From: matiu Date: Thu, 31 Aug 2017 18:16:50 -0300 Subject: [PATCH] fix non equiv bch --- src/js/controllers/amount.js | 11 ++++++++++- www/views/amount.html | 3 ++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/js/controllers/amount.js b/src/js/controllers/amount.js index 70a7b3a44..dee20cde1 100644 --- a/src/js/controllers/amount.js +++ b/src/js/controllers/amount.js @@ -304,7 +304,14 @@ angular.module('copayApp.controllers').controller('amountController', function($ $scope.globalResult = isExpression($scope.amount) ? '= ' + processResult(result) : ''; if (availableUnits[unitIndex].isFiat) { - $scope.alternativeAmount = txFormatService.formatAmount(fromFiat(result) * unitToSatoshi, true); + + var a = fromFiat(result); + if (a) { + $scope.alternativeAmount = txFormatService.formatAmount(a * unitToSatoshi, true); + } else { + $scope.alternativeAmount = 'N/A'; //TODO + $scope.allowSend = false; + } } else { $scope.alternativeAmount = $filter('formatFiatAmount')(toFiat(result)); } @@ -321,6 +328,8 @@ angular.module('copayApp.controllers').controller('amountController', function($ }; function toFiat(val) { + if (!rateService.getRate(fiatCode)) return; + return parseFloat((rateService.toFiat(val * unitToSatoshi, fiatCode, availableUnits[unitIndex].id)).toFixed(2)); }; diff --git a/www/views/amount.html b/www/views/amount.html index 5d79f8ad7..a522d712c 100644 --- a/www/views/amount.html +++ b/www/views/amount.html @@ -52,7 +52,8 @@
{{globalResult}} {{unit}}
-
≈ {{alternativeAmount || '0.00'}} {{alternativeUnit}}
+
≈ {{alternativeAmount || '0.00'}} {{alternativeUnit}}
+