From d79a0f66aea9c184896291cfede808d87399f043 Mon Sep 17 00:00:00 2001
From: "raja.blaze"
Date: Mon, 19 Aug 2019 13:33:05 +0530
Subject: [PATCH] issues fixed
---
server/controllers/BlockchainBlock.ts | 42 +++++++++++++++++++
server/controllers/BlockchainKernel.ts | 5 +++
.../block-detail-list.component.html | 2 +-
.../home/graph-list/graph-list.component.ts | 27 +++++++++---
.../latestblocks/latestblocks.component.html | 2 +-
5 files changed, 70 insertions(+), 8 deletions(-)
diff --git a/server/controllers/BlockchainBlock.ts b/server/controllers/BlockchainBlock.ts
index 2624244..2431f09 100644
--- a/server/controllers/BlockchainBlock.ts
+++ b/server/controllers/BlockchainBlock.ts
@@ -1169,6 +1169,13 @@ export class BlockchainBlockController {
blockDate.push(moment(e.date).format('YYYY-MM-DD'));
blocks.push(parseInt(e.blocks));
});
+
+ if(date.length == 0){
+ date = [moment(Date.now()).format('YYYY-MM-DD')];
+ blockDate = [moment(Date.now()).format('YYYY-MM-DD')];
+ blocks = [0];
+ }
+
response.status(200).json({
status: 200,
timestamp: Date.now(),
@@ -1334,6 +1341,13 @@ export class BlockchainBlockController {
return moment(e.date).format(dateFormat);
});
+ if(date.length == 0){
+ date = [moment(Date.now()).format(dateFormat)];
+ DifficultyCuckatoo = [0];
+ DifficultyProgpow = [0];
+ DifficultyRandomx = [0];
+ }
+
// TotalDifficultyNBlockQuery.forEach(e => {
// date.push(moment(e.date).format(dateFormat));
// DifficultyCuckatoo.push(parseInt(e.total_difficulty_cuckatoo));
@@ -1467,6 +1481,13 @@ export class BlockchainBlockController {
ProgPow.push(parseInt(e.progpow));
RandomX.push(parseInt(e.randomx));
});
+
+ if(date.length == 0){
+ date = [moment(Date.now()).format('YYYY-MM-DD')];
+ Cuckoo = [0];
+ ProgPow = [0];
+ RandomX = [0];
+ }
response.status(200).json({
status: 200,
timestamp: Date.now(),
@@ -1920,6 +1941,11 @@ let remaining_height = 0;
date.push(moment(e.date).format('YYYY-MM-DD'));
period.push(parseInt(e.period));
});
+
+ if(date.length == 0){
+ date = [moment(Date.now()).format('YYYY-MM-DD')];
+ period = [0];
+ }
response.status(200).json({
status: 200,
timestamp: Date.now(),
@@ -2031,6 +2057,12 @@ let remaining_height = 0;
addedreward.push(prev_value + parseInt(e.total_reward_per_day));
prev_value = prev_value + parseInt(e.total_reward_per_day);
});
+
+ if(date.length == 0){
+ date = [moment(Date.now()).format('YYYY-MM-DD')];
+ total_reward_per_day = [0];
+ addedreward = [0];
+ }
response.status(200).json({
status: 200,
timestamp: Date.now(),
@@ -2125,6 +2157,16 @@ let remaining_height = 0;
ProgPow.push(parseInt(e.progpow));
});
+ if(date.length == 0){
+ date = [moment(Date.now()).format('YYYY-MM-DD')];
+ RandomXper = [0];
+ Cuckooper = [0];
+ ProgPowper = [0];
+ RandomX = [0];
+ Cuckoo = [0];
+ ProgPow = [0];
+ }
+
response.status(200).json({
status: 200,
timestamp: Date.now(),
diff --git a/server/controllers/BlockchainKernel.ts b/server/controllers/BlockchainKernel.ts
index f8d0c55..29c9a58 100644
--- a/server/controllers/BlockchainKernel.ts
+++ b/server/controllers/BlockchainKernel.ts
@@ -646,6 +646,11 @@ export class BlockchainKernelController {
date.push(moment(e.date).format('YYYY-MM-DD'));
Fee.push(parseInt(e.fee));
});
+
+ if(date.length == 0){
+ date = [moment(Date.now()).format('YYYY-MM-DD')];
+ Fee = [0];
+ }
response.status(200).json({
status: 200,
timestamp: Date.now(),
diff --git a/src/app/view/home/block-detail-list/block-detail-list.component.html b/src/app/view/home/block-detail-list/block-detail-list.component.html
index 66756a3..fc8b7c5 100644
--- a/src/app/view/home/block-detail-list/block-detail-list.component.html
+++ b/src/app/view/home/block-detail-list/block-detail-list.component.html
@@ -48,7 +48,7 @@
class="count mb-0"
[ngClass]="latestblockdetail.blink == true ? 'item-highlight' : ''"
>
- {{ latestblockdetail.letest_block_num }} {{ latestblockdetail.letest_block_duration }}
+ {{ latestblockdetail.letest_block_num | number }} {{ latestblockdetail.letest_block_duration | number }}
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 883a10b..aae4db0 100644
--- a/src/app/view/home/graph-list/graph-list.component.ts
+++ b/src/app/view/home/graph-list/graph-list.component.ts
@@ -591,12 +591,14 @@ export class GraphListComponent implements OnInit {
tickangle: -45,
tickformat: tickformat,
fixedrange: true,
+ rangemode: 'nonnegative',
domain: [0.2, 0.8]
// showgrid: true
},
yaxis: {
title: 'Cuckoo',
fixedrange: true,
+ rangemode: 'nonnegative'
// showgrid: true,
// range: range
},
@@ -606,6 +608,7 @@ export class GraphListComponent implements OnInit {
// showgrid: true,
// range: range,
overlaying: 'y',
+ rangemode: 'nonnegative',
side: 'left',
position: 1.25
},
@@ -616,6 +619,7 @@ export class GraphListComponent implements OnInit {
// range: range,
anchor: 'x',
overlaying: 'y',
+ rangemode: 'nonnegative',
side: 'right'
},
@@ -737,12 +741,14 @@ export class GraphListComponent implements OnInit {
tickangle: -45,
tickformat: '%m-%d',
showgrid: true,
+ rangemode: 'nonnegative',
fixedrange: true
},
yaxis: {
title: 'Blocks',
showgrid: true,
- fixedrange: true
+ fixedrange: true,
+ rangemode: 'nonnegative'
},
margin: {
l: 50,
@@ -780,12 +786,14 @@ export class GraphListComponent implements OnInit {
tickangle: -45,
showgrid: true,
title: 'Blocks Height',
+ rangemode: 'nonnegative',
fixedrange: true
},
yaxis: {
title: 'Seonds',
showgrid: true,
- fixedrange: true
+ fixedrange: true,
+ rangemode: 'nonnegative'
},
margin: {
l: 50,
@@ -824,10 +832,12 @@ export class GraphListComponent implements OnInit {
tickangle: -45,
tickformat: '%m-%d',
showgrid: true,
- fixedrange: true
+ fixedrange: true,
+ rangemode: 'nonnegative'
},
yaxis: {
title: 'Blocks',
+ rangemode: 'nonnegative',
showgrid: true,
fixedrange: true
},
@@ -940,7 +950,7 @@ export class GraphListComponent implements OnInit {
y: bPeriod,
text: bPeriod,
name: '',
- hovertemplate: '%{x}
Blocks Per Sec : %{text:,}',
+ hovertemplate: '%{x}
Seconds per Block : %{text:,}',
fill: 'tozeroy',
type: 'line',
line: {
@@ -1224,13 +1234,15 @@ export class GraphListComponent implements OnInit {
showgrid: false,
zeroline: false,
tickformat: '%m-%d',
- fixedrange: true
+ fixedrange: true,
+ rangemode: 'nonnegative'
},
yaxis: {
showline: false,
title: 'Estimated Hashrate (GH/s)',
showgrid: true,
- fixedrange: true
+ fixedrange: true,
+ rangemode: 'nonnegative',
},
margin: {
l: 50,
@@ -1263,6 +1275,7 @@ export class GraphListComponent implements OnInit {
yaxis: {
title: 'Cuckoo',
fixedrange: true,
+ rangemode: 'nonnegative',
// showgrid: true,
// range: range
},
@@ -1272,6 +1285,7 @@ export class GraphListComponent implements OnInit {
// showgrid: true,
// range: range,
overlaying: 'y',
+ rangemode: 'nonnegative',
side: 'left',
position: 1.25
},
@@ -1280,6 +1294,7 @@ export class GraphListComponent implements OnInit {
fixedrange: true,
// showgrid: true,
// range: range,
+ rangemode: 'nonnegative',
anchor: 'x',
overlaying: 'y',
side: 'right'
diff --git a/src/app/view/home/latestblocks/latestblocks.component.html b/src/app/view/home/latestblocks/latestblocks.component.html
index 251b1be..b71bfed 100644
--- a/src/app/view/home/latestblocks/latestblocks.component.html
+++ b/src/app/view/home/latestblocks/latestblocks.component.html
@@ -280,7 +280,7 @@
Total Difficulty
- {{ peer.total_difficulty.cuckaroo }},{{ peer.total_difficulty.cuckatoo}},{{ peer.total_difficulty.progpow}},{{ peer.total_difficulty.randomx}}
+ {{ peer.total_difficulty.cuckaroo | number }} / {{ peer.total_difficulty.cuckatoo | number}} / {{ peer.total_difficulty.progpow | number}} / {{ peer.total_difficulty.randomx | number}}