From db18e33d82167ed0bec7cb14a353104d17dce742 Mon Sep 17 00:00:00 2001 From: shunmugam Date: Tue, 7 Jan 2020 17:42:28 +0530 Subject: [PATCH] Commit for add timezone in query --- server/controllers/BlockchainBlock.ts | 30 ++++++++++++---- .../graph-detail/graph-detail.component.html | 8 +++++ .../home/graph-list/graph-list.component.html | 20 +++++++++++ .../home/graph-list/graph-list.component.ts | 34 +++++++++++++++++-- 4 files changed, 83 insertions(+), 9 deletions(-) diff --git a/server/controllers/BlockchainBlock.ts b/server/controllers/BlockchainBlock.ts index 7477f63..b042e25 100644 --- a/server/controllers/BlockchainBlock.ts +++ b/server/controllers/BlockchainBlock.ts @@ -1668,8 +1668,14 @@ export class BlockchainBlockController { .utc() .format('YYYY-MM-DD'); - var timeIntervalQry = - 'timestamp BETWEEN SYMMETRIC ' + fromdate + ' AND ' + todate; + var timeIntervalQry = + "timestamp at time zone '" + + process.env.TIME_ZONE + + "' BETWEEN SYMMETRIC '" + + fromdate + + "' AND '" + + todate + + "'"; var seriesquery = "'" + fromdate + "'::timestamp, '" + todate + "'"; } else { @@ -1777,8 +1783,14 @@ export class BlockchainBlockController { .utc() .format('YYYY-MM-DD'); - var timeIntervalQry = - 'timestamp BETWEEN SYMMETRIC ' + fromdate + ' AND ' + todate; + var timeIntervalQry = + "timestamp at time zone '" + + process.env.TIME_ZONE + + "' BETWEEN SYMMETRIC '" + + fromdate + + "' AND '" + + todate + + "'"; } else { var timeIntervalQry = "timestamp > current_date - interval '30 days'"; } @@ -1842,8 +1854,14 @@ export class BlockchainBlockController { .utc() .format('YYYY-MM-DD'); - var timeIntervalQry = - 'timestamp BETWEEN SYMMETRIC ' + fromdate + ' AND ' + todate; + var timeIntervalQry = + "timestamp at time zone '" + + process.env.TIME_ZONE + + "' BETWEEN SYMMETRIC '" + + fromdate + + "' AND '" + + todate + + "'"; } else { var timeIntervalQry = "timestamp > current_date - interval '30 days'"; } diff --git a/src/app/view/graph-view/graph-detail/graph-detail.component.html b/src/app/view/graph-view/graph-detail/graph-detail.component.html index 23ae675..6932c11 100644 --- a/src/app/view/graph-view/graph-detail/graph-detail.component.html +++ b/src/app/view/graph-view/graph-detail/graph-detail.component.html @@ -121,6 +121,14 @@ ChartFromView('', '', '3 months', comp.Type); selectedItem = 5; comp.difficultyRange = '3 months';comp.TdifficultyRange = '3 months' " id="5" #item5 [ngClass]="{ active: selectedItem == item5.id, day3m_txt: true }">3 {{'home.MONTHS' | translate}} + + + {{'home.All' | translate}} + + +
diff --git a/src/app/view/home/graph-list/graph-list.component.html b/src/app/view/home/graph-list/graph-list.component.html index ce74b05..5ed2ec5 100644 --- a/src/app/view/home/graph-list/graph-list.component.html +++ b/src/app/view/home/graph-list/graph-list.component.html @@ -164,6 +164,13 @@ 3 {{'home.MONTHS' | translate}} + + {{'home.All' | translate}} + + +
{{'home.EXPLORE_IT' | translate}} @@ -210,6 +217,13 @@ [ngClass]="{ active: selectedItem5 == item4.id, day60_txt: true }">60 {{'home.DAYS' | translate}} 3 {{'home.MONTHS' | translate}} + {{'home.All' | translate}} + + + +
{{'home.EXPLORE_IT' | translate}} 60 {{'home.DAYS' | translate}} 3 {{'home.MONTHS' | translate}} + + {{'home.All' | translate}} + +
{{'home.EXPLORE_IT' | translate}} diff --git a/src/app/view/home/graph-list/graph-list.component.ts b/src/app/view/home/graph-list/graph-list.component.ts index 309f383..8ecf479 100644 --- a/src/app/view/home/graph-list/graph-list.component.ts +++ b/src/app/view/home/graph-list/graph-list.component.ts @@ -362,9 +362,19 @@ export class GraphListComponent implements OnInit { Growthreq(fromDate = '', ToDate = '', interval = '') { return new Promise((resolve, reject) => { let params = new HttpParams(); + + this.growthGraphData = [] + if(interval == "all") { + // this.Type="" + fromDate = "2019-09-05 00:00:00" + ToDate = moment(new Date()).format("YYYY-MM-DD 23:29:59") + } + + params = params.append('Interval', (interval == "all")?"":interval); + params = params.append('FromDate', fromDate); params = params.append('ToDate', ToDate); - params = params.append('Interval', interval); + // params = params.append('Interval', interval); this.chartService .apiGetRequest(params, '/blockchain_block/supplygrowth') .subscribe( @@ -394,9 +404,19 @@ export class GraphListComponent implements OnInit { Transcationreq(fromDate = '', ToDate = '', interval = '') { return new Promise((resolve, reject) => { let params = new HttpParams(); + + + this.transcationGraphData = [] + if(interval == "all") { + fromDate = "2019-09-03 00:00:00" + ToDate = moment(new Date()).format("YYYY-MM-DD 23:29:59") + } + + params = params.append('Interval', (interval == "all")?"":interval); params = params.append('FromDate', fromDate); params = params.append('ToDate', ToDate); - params = params.append('Interval', interval); + + // params = params.append('Interval', interval); this.chartService .apiGetRequest(params, '/blockchain_kernel/transactionfee') .subscribe( @@ -613,9 +633,17 @@ export class GraphListComponent implements OnInit { ) { return new Promise((resolve, reject) => { let params = new HttpParams(); + this.barGraphData = [] + if(interval == "all") { + // this.Type="" + fromDate = "2019-09-03 00:00:00" + ToDate = moment(new Date()).format("YYYY-MM-DD 23:29:59") + } + + params = params.append('Interval', (interval == "all")?"":interval); params = params.append('FromDate', fromDate); params = params.append('ToDate', ToDate); - params = params.append('Interval', interval); + // params = params.append('Interval', interval); this.chartService .apiGetRequest(params, '/blockchain_block/blockcount') .subscribe(