Updates getting history to new bws limit
This commit is contained in:
parent
8467f50567
commit
4983cfb4c4
2 changed files with 23 additions and 7 deletions
|
|
@ -46,6 +46,7 @@
|
|||
"> Updating Wallet... </span>
|
||||
<span translate ng-show="index.onGoingProcessName == 'scanning'">Scanning Wallet funds...</span>
|
||||
<span translate ng-show="index.onGoingProcessName == 'recreating'">Recreating Wallet...</span>
|
||||
<span translate ng-show="index.onGoingProcessName == 'generatingCSV'">Generating .csv file...</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -551,7 +551,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
var fs = require('fs');
|
||||
fs.writeFile(this.value, data, function(err) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
$log.debug(err);
|
||||
}
|
||||
});
|
||||
}, false);
|
||||
|
|
@ -561,7 +561,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
function formatDate(date) {
|
||||
var dateObj = new Date(date);
|
||||
if (!dateObj) {
|
||||
log.error('Error formating a date');
|
||||
$log.debug('Error formating a date');
|
||||
return 'DateError'
|
||||
}
|
||||
if (!dateObj.toJSON()) {
|
||||
|
|
@ -585,21 +585,36 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
return str;
|
||||
}
|
||||
|
||||
function getHistory(skip, cb) {
|
||||
skip = skip || 0;
|
||||
fc.getTxHistory({
|
||||
skip: skip,
|
||||
limit: 100
|
||||
}, function(err, txs) {
|
||||
if (err) return cb(err);
|
||||
if (txs && txs.length > 0) {
|
||||
allTxs.push(txs);
|
||||
getHistory(skip + 100, cb);
|
||||
}
|
||||
else {
|
||||
return cb(null, lodash.flatten(allTxs));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
if (isCordova) {
|
||||
log.info('Not available on mobile');
|
||||
$log.info('Not available on mobile');
|
||||
return;
|
||||
}
|
||||
var isNode = nodeWebkit.isDefined();
|
||||
var fc = profileService.focusedClient;
|
||||
if (!fc.isComplete()) return;
|
||||
var self = this;
|
||||
var allTxs = [];
|
||||
$log.debug('Generating CSV from History');
|
||||
self.setOngoingProcess('generatingCSV', true);
|
||||
$timeout(function() {
|
||||
fc.getTxHistory({
|
||||
skip: 0,
|
||||
limit: 1000000000
|
||||
}, function(err, txs) {
|
||||
getHistory(null, function(err, txs) {
|
||||
self.setOngoingProcess('generatingCSV', false);
|
||||
if (err) {
|
||||
$log.debug('TxHistory ERROR:', err);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue