Skip to content

Commit

Permalink
fixing wrong transactions count in info block #51
Browse files Browse the repository at this point in the history
  • Loading branch information
r-gochain authored and rkononov committed Jul 10, 2018
1 parent 3cc48e7 commit 3e0edf3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions public/js/controllers/AddressController.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ angular.module('BlocksApp').controller('AddressController', function($stateParam
data: { "addr": $scope.addrHash, "count": count }
},
"lengthMenu": [
[10, 20, 50, 100, 150, -1],
[10, 20, 50, 100, 150, "All"] // change per page values here
[10, 20, 50, 100, 250],
[10, 20, 50, 100, 250] // change per page values here
],
"pageLength": 20,
"order": [
Expand Down
24 changes: 12 additions & 12 deletions routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,20 +93,20 @@ var getAddr = function (req, res) {
var limit = parseInt(req.body.length);
var start = parseInt(req.body.start);

var data = { draw: parseInt(req.body.draw), recordsFiltered: count, recordsTotal: count };

var addrFind = Transaction.find({ $or: [{ "to": addr }, { "from": addr }] })

addrFind.lean(true).sort('-blockNumber').skip(start).limit(limit)
.exec("find", function (err, docs) {
if (docs)
data.data = filters.filterTX(docs, addr);
else
data.data = [];
res.write(JSON.stringify(data));
res.end();
});

addrFind.exec("count", function (err, count) {
var data = { draw: parseInt(req.body.draw), recordsFiltered: count, recordsTotal: count };
addrFind.lean(true).sort('-blockNumber').skip(start).limit(limit)
.exec("find", function (err, docs) {
if (docs)
data.data = filters.filterTX(docs, addr);
else
data.data = [];
res.write(JSON.stringify(data));
res.end();
});
});
};


Expand Down

0 comments on commit 3e0edf3

Please sign in to comment.