Remove unnused variable. Added tests to check amount validation

This commit is contained in:
Gustavo Maximiliano Cortez 2015-01-30 11:09:07 -03:00
commit 6586a4b696
2 changed files with 23 additions and 6 deletions

View file

@ -5,8 +5,6 @@ var preconditions = require('preconditions').singleton();
angular.module('copayApp.controllers').controller('SendController',
function($scope, $rootScope, $window, $timeout, $modal, $filter, notification, isMobile, rateService, txStatus, isCordova) {
var satToUnit;
$scope.init = function() {
var w = $rootScope.wallet;
preconditions.checkState(w);
@ -23,8 +21,6 @@ angular.module('copayApp.controllers').controller('SendController',
$scope.loading = false;
$scope.error = $scope.success = null;
satToUnit = 1 / w.settings.unitToSatoshi;
$scope.alternativeName = w.settings.alternativeName;
$scope.alternativeIsoCode = w.settings.alternativeIsoCode;
@ -101,7 +97,7 @@ angular.module('copayApp.controllers').controller('SendController',
this.__alternative = newValue;
if (typeof(newValue) === 'number' && $scope.isRateAvailable) {
this._amount = parseFloat(
(rateService.fromFiat(newValue, $scope.alternativeIsoCode) * satToUnit).toFixed(w.settings.unitDecimals), 10);
(rateService.fromFiat(newValue, $scope.alternativeIsoCode) * 1 / w.settings.unitToSatoshi).toFixed(w.settings.unitDecimals), 10);
} else {
this._amount = 0;
}