Change AJAX query logic
This commit is contained in:
+10
-10
@@ -444,20 +444,20 @@ module.exports = {
|
||||
},
|
||||
|
||||
get_last_txs_ajax: function(start, length, min, cb) {
|
||||
Tx.countDocuments({'total': {$gte: min}}, function(err, count){
|
||||
Tx.find({'total': {$gte: min}}).sort({blockindex: 'desc'}).skip(Number(start)).limit(Number(length)).exec(function(err, txs){
|
||||
if (err) {
|
||||
return cb(err);
|
||||
} else {
|
||||
return cb(txs, count);
|
||||
}
|
||||
});
|
||||
Tx.find({'total': {$gte: min}}).count(function(err, count){
|
||||
Tx.find({'total': {$gte: min}}).sort({blockindex: -1}).skip(Number(start)).limit(Number(length)).exec(function(err, txs){
|
||||
if (err) {
|
||||
return cb(err);
|
||||
} else {
|
||||
return cb(txs, count);
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
get_address_txs_ajax: function(hash, start, length, cb) {
|
||||
var totalCount = 0;
|
||||
AddressTx.find({a_id: hash}).countDocuments({}, function(err, count){
|
||||
AddressTx.find({a_id: hash}).count(function(err, count){
|
||||
if(err) {
|
||||
return cb(err);
|
||||
} else {
|
||||
@@ -483,7 +483,7 @@ module.exports = {
|
||||
if (err) {
|
||||
return cb(err);
|
||||
} else {
|
||||
AddressTx.find({a_id: hash}).sort({blockindex: 'desc'}).skip(Number(start)).limit(Number(length)).exec(function (err, address_tx) {
|
||||
AddressTx.find({a_id: hash}).sort({blockindex: -1}).skip(Number(start)).limit(Number(length)).exec(function (err, address_tx) {
|
||||
if (err) {
|
||||
return cb(err);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user