fix non equiv bch

This commit is contained in:
matiu 2017-08-31 18:16:50 -03:00
commit d074a7da7f
2 changed files with 12 additions and 2 deletions

View file

@ -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));
};