avoid computing alternative currency rate when no txs in history

This commit is contained in:
Ivan Socolsky 2014-12-03 09:45:45 -03:00
commit 120fcafeda

View file

@ -85,6 +85,7 @@ angular.module('copayApp.controllers').controller('HistoryController',
tx.amount = $filter('noFractionNumber')(tx.amount); tx.amount = $filter('noFractionNumber')(tx.amount);
}); });
if (items.length > 0) {
var index = _.indexBy(items, 'rateTs'); var index = _.indexBy(items, 'rateTs');
rateService.getHistoricRates(w.settings.alternativeIsoCode, _.keys(index), function(err, res) { rateService.getHistoricRates(w.settings.alternativeIsoCode, _.keys(index), function(err, res) {
if (!err && res) { if (!err && res) {
@ -98,6 +99,7 @@ angular.module('copayApp.controllers').controller('HistoryController',
}, 1); }, 1);
} }
}); });
}
$scope.blockchain_txs = w.cached_txs = items; $scope.blockchain_txs = w.cached_txs = items;
$scope.nbPages = res.nbPages; $scope.nbPages = res.nbPages;