extend rate services to retrieve historic rates
This commit is contained in:
parent
ec4d774bae
commit
3eb45e529f
3 changed files with 50 additions and 13 deletions
|
|
@ -140,11 +140,27 @@ angular.module('copayApp.controllers').controller('HistoryController',
|
|||
}
|
||||
|
||||
var items = res.items;
|
||||
|
||||
_.each(items, function(r) {
|
||||
r.ts = r.minedTs || r.sentTs;
|
||||
_.each(items, function(tx) {
|
||||
tx.ts = tx.minedTs || tx.sentTs;
|
||||
});
|
||||
|
||||
var index = _.indexBy(res.items, function(tx) {
|
||||
return Math.floor(tx.ts / 1000);
|
||||
});
|
||||
rateService.getHistoricRates(w.settings.alternativeIsoCode, _.keys(index), function(err, res) {
|
||||
console.log(res);
|
||||
if (!err && res) {
|
||||
_.each(res, function(r) {
|
||||
var tx = index[r.ts];
|
||||
tx.alternativeAmount = tx.amountSat * rateService.SAT_TO_BTC * r.rate;
|
||||
});
|
||||
setTimeout(function() {
|
||||
$scope.$digest();
|
||||
}, 1);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
$scope.blockchain_txs = w.cached_txs = items;
|
||||
$scope.nbPages = res.nbPages;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue