block interval updated

This commit is contained in:
root 2019-09-09 15:08:36 +05:30
parent 71c4d05971
commit 861e00289e

View File

@ -1716,7 +1716,7 @@ export class BlockchainBlockController {
request.query; request.query;
if (BlockchainBlockPerSecondData.Interval) { if (BlockchainBlockPerSecondData.Interval) {
var timeIntervalQry = var timeIntervalQry =
"timestamp > (current_date-1) - interval '" + "timestamp > current_date - interval '" +
BlockchainBlockPerSecondData.Interval + BlockchainBlockPerSecondData.Interval +
"'"; "'";
} else if ( } else if (
@ -1733,14 +1733,14 @@ export class BlockchainBlockController {
var timeIntervalQry = var timeIntervalQry =
'timestamp BETWEEN SYMMETRIC ' + fromdate + ' AND ' + todate; 'timestamp BETWEEN SYMMETRIC ' + fromdate + ' AND ' + todate;
} else { } else {
var timeIntervalQry = "timestamp > (current_date-1) - interval '30 days'"; var timeIntervalQry = "timestamp > current_date - interval '30 days'";
} }
const BlockchainBlockPerSecondQuery = await getConnection(Global.network) const BlockchainBlockPerSecondQuery = await getConnection(Global.network)
.query( .query(
"select date(DATE_TRUNC('day', timestamp)) as date, count(hash) as blocks, 86400/count(hash) as period \ "select date(DATE_TRUNC('day', timestamp)) as date, count(hash) as blocks, 86400/count(hash) as period \
from blockchain_block where " + from blockchain_block where " +
timeIntervalQry + timeIntervalQry +
"AND height != 0 group by DATE_TRUNC('day', timestamp) order by date", "AND height != 0 AND timestamp < current_date group by DATE_TRUNC('day', timestamp) order by date",
) )
.catch(err_msg => { .catch(err_msg => {
next(err_msg); next(err_msg);