filter unavailable wallets

This commit is contained in:
Ivan Socolsky 2016-09-14 11:03:43 -03:00
commit e69ceffb59
No known key found for this signature in database
GPG key ID: FAECE6A05FAA4F56

View file

@ -120,12 +120,14 @@ angular.module('copayApp.controllers').controller('confirmController', function(
lodash.each(wallets, function(w) {
walletService.getStatus(w, {}, function(err, status) {
if (err) $log.error(err);
if (!status.availableBalanceSat) $log.debug('No balance available in: ' + w.name);
if (status.availableBalanceSat > amount) filteredWallets.push(w);
if (err || !status) {
$log.error(err);
} else {
if (!status.availableBalanceSat) $log.debug('No balance available in: ' + w.name);
if (status.availableBalanceSat > amount) filteredWallets.push(w);
}
if (++index == wallets.length) {
if (!lodash.isEmpty(filteredWallets)) {
$scope.wallets = lodash.clone(filteredWallets);
$scope.notAvailable = false;
@ -136,7 +138,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
$timeout(function() {
$scope.$apply();
}, 10);
});
return;
}
});