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,14 +122,14 @@ angular.module('copayApp.controllers').controller('HistoryController',
|
||||||
|
|
||||||
$scope._addRates = function(w, txs, cb) {
|
$scope._addRates = function(w, txs, cb) {
|
||||||
if (!txs || txs.length == 0) return 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) {
|
rateService.getHistoricRates(w.settings.alternativeIsoCode, _.keys(index), function(err, res) {
|
||||||
if (err) return cb(err);
|
if (err || !res) return cb(err);
|
||||||
if (!res) return cb();
|
|
||||||
_.each(res, function(r) {
|
_.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);
|
var alternativeAmount = (r.rate != null ? tx.amountSat * rateService.SAT_TO_BTC * r.rate : null);
|
||||||
tx.alternativeAmount = alternativeAmount ? $filter('noFractionNumber')(alternativeAmount, 2) : null;
|
tx.alternativeAmount = alternativeAmount ? $filter('noFractionNumber')(alternativeAmount, 2) : null;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
return cb();
|
return cb();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue