fix selection of cards at .get

This commit is contained in:
Matias Alejo Garcia 2017-02-01 11:42:18 -03:00
commit 96764917c7
No known key found for this signature in database
GPG key ID: 02470DB551277AB3
2 changed files with 16 additions and 12 deletions

View file

@ -143,6 +143,7 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
$state.go('tabs.home'); $state.go('tabs.home');
} }
bitpayCardService.get({ bitpayCardService.get({
cardId: $scope.cardId, cardId: $scope.cardId,
noRefresh: true, noRefresh: true,

View file

@ -232,15 +232,18 @@ angular.module('copayApp.services').factory('bitpayCardService', function($log,
return cb(); return cb();
} }
if (opts.cardId) {
cards = lodash.filter(cards, function(x) {
return opts.cardId == x.eid;
});
}
// Async, no problem // Async, no problem
lodash.each(cards, function(x) { lodash.each(cards, function(x) {
if (opts.cardId) {
if (opts.cardId != x.eid) return;
}
root.addLastKnownBalance(x, function() {}); root.addLastKnownBalance(x, function() {});
// async refresh
if (!opts.noRefresh) { if (!opts.noRefresh) {
root.getHistory(x.id, {}, function(err, data) { root.getHistory(x.id, {}, function(err, data) {
if (err) return; if (err) return;