Move pagination of transaction proposals to the backend
This commit is contained in:
parent
c51731dc69
commit
15fc035ba9
4 changed files with 16 additions and 11 deletions
|
|
@ -13,7 +13,12 @@ angular.module('copay.transactions').controller('TransactionsController',
|
|||
|
||||
$scope.update = function () {
|
||||
$scope.loading = false;
|
||||
controllerUtils.updateTxs({onlyPending:$scope.onlyPending});
|
||||
var from = ($scope.txpCurrentPage-1) * $scope.txpItemsPerPage;
|
||||
var opts = {
|
||||
onlyPending: $scope.onlyPending,
|
||||
skip: !$scope.onlyPending ? [from, from + $scope.txpItemsPerPage] : null
|
||||
};
|
||||
controllerUtils.updateTxs(opts);
|
||||
$rootScope.$digest();
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -21,11 +21,7 @@ angular.module('copay.filters', [])
|
|||
};
|
||||
})
|
||||
.filter('paged', function() {
|
||||
return function(elements, page, pageSize, disable) {
|
||||
if (disable) return elements;
|
||||
|
||||
var from = (page - 1) * pageSize;
|
||||
var to = from + pageSize;
|
||||
return elements.slice(from, to);;
|
||||
return function(elements) {
|
||||
return elements.filter(Boolean);
|
||||
};
|
||||
});
|
||||
|
|
|
|||
|
|
@ -132,11 +132,15 @@ angular.module('copay.controllerUtils')
|
|||
console.log('## updating tx proposals', opts); //TODO
|
||||
var myCopayerId = w.getMyCopayerId();
|
||||
var pendingForUs = 0;
|
||||
var inT = w.getTxProposals();
|
||||
var inT = w.getTxProposals().sort(function(t1, t2) { return t1.createdTs < t2.createdTs });
|
||||
var txs = [];
|
||||
|
||||
console.log('[START LOOP]'); //TODO
|
||||
inT.forEach(function(i){
|
||||
inT.forEach(function(i, index){
|
||||
if (opts.skip && (index < opts.skip[0] || index >= opts.skip[1])) {
|
||||
return txs.push(null);
|
||||
}
|
||||
|
||||
if (myCopayerId != i.creator && !i.finallyRejected && !i.sentTs && !i.rejectedByUs && !i.signedByUs) {
|
||||
pendingForUs++;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue