Merge pull request #1943 from isocolsky/bug/history

avoid computing alternative currency rate when no txs in history
This commit is contained in:
Matias Alejo Garcia 2014-12-03 16:55:10 -03:00
commit 06aa4eab06

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;