front-end of block list by date is ready. fillCache for getting blocks.
This commit is contained in:
parent
f1c52a97a0
commit
2a2a2110f5
|
@ -72,7 +72,7 @@ console.log('[blocks.js.60]: could not get %s from RPC. Orphan? Error?', blockha
|
|||
* List of blocks by date
|
||||
*/
|
||||
exports.list = function(req, res) {
|
||||
var limit = req.query.limit || 0;
|
||||
var limit = req.query.limit || -1;
|
||||
var isToday = false;
|
||||
|
||||
//helper to convert timestamps to yyyy-mm-dd format
|
||||
|
@ -103,23 +103,14 @@ exports.list = function(req, res) {
|
|||
var prev = formatTimestamp(new Date((gte - 86400) * 1000));
|
||||
var next = formatTimestamp(new Date(lte * 1000));
|
||||
|
||||
/*
|
||||
Block
|
||||
.find({
|
||||
time: {
|
||||
'$gte': gte,
|
||||
'$lte': lte
|
||||
}
|
||||
})
|
||||
.limit(limit)
|
||||
.sort('-time')
|
||||
.exec(function(err, blocks) {
|
||||
bdb.getBlocksByDate(gte, lte, limit, function(err, blocks) {
|
||||
if (err) {
|
||||
res.status(500).send(err);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
var blockshashList = [];
|
||||
for(var i=0;i<blocks.length;i++) {
|
||||
blockshashList.push(blocks[i].hash);
|
||||
blockshashList.unshift(blocks[i].hash);
|
||||
}
|
||||
async.mapSeries(blockshashList, getBlock, function(err, allblocks) {
|
||||
res.jsonp({
|
||||
|
@ -135,5 +126,4 @@ exports.list = function(req, res) {
|
|||
});
|
||||
}
|
||||
});
|
||||
*/
|
||||
};
|
||||
|
|
|
@ -133,7 +133,8 @@ function spec(b) {
|
|||
db.createReadStream({
|
||||
start: TIMESTAMP_ROOT + start_ts,
|
||||
end: TIMESTAMP_ROOT + end_ts,
|
||||
limit: limit
|
||||
fillCache: true,
|
||||
limit: parseInt(limit) // force to int
|
||||
})
|
||||
.on('data', function (data) {
|
||||
list.push({
|
||||
|
|
|
@ -20,11 +20,11 @@ angular.module('insight').config(function($routeProvider) {
|
|||
title: 'Home'
|
||||
}).
|
||||
when('/blocks', {
|
||||
templateUrl: '/views/blocks_list.html',
|
||||
templateUrl: '/views/block_list.html',
|
||||
title: 'Bitcoin Blocks solved Today'
|
||||
}).
|
||||
when('/blocks-date/:blockDate', {
|
||||
templateUrl: '/views/blocks_list.html',
|
||||
templateUrl: '/views/block_list.html',
|
||||
title: 'Bitcoin Blocks solved '
|
||||
}).
|
||||
when('/address/:addrStr', {
|
||||
|
|
Loading…
Reference in New Issue