mirror of https://github.com/BTCPrivate/copay.git
Merge pull request #2127 from isocolsky/alt_rate
fixed alternative rate not showing in history
This commit is contained in:
commit
789d6fbf3b
|
@ -122,15 +122,15 @@ angular.module('copayApp.controllers').controller('HistoryController',
|
|||
|
||||
$scope._addRates = function(w, txs, cb) {
|
||||
if (!txs || txs.length == 0) return cb();
|
||||
var index = _.indexBy(txs, 'rateTs');
|
||||
var index = _.groupBy(txs, 'rateTs');
|
||||
rateService.getHistoricRates(w.settings.alternativeIsoCode, _.keys(index), function(err, res) {
|
||||
if (err) return cb(err);
|
||||
if (!res) return cb();
|
||||
if (err || !res) return cb(err);
|
||||
_.each(res, function(r) {
|
||||
var tx = index[r.ts];
|
||||
_.each(index[r.ts], function (tx) {
|
||||
var alternativeAmount = (r.rate != null ? tx.amountSat * rateService.SAT_TO_BTC * r.rate : null);
|
||||
tx.alternativeAmount = alternativeAmount ? $filter('noFractionNumber')(alternativeAmount, 2) : null;
|
||||
});
|
||||
});
|
||||
return cb();
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue