This commit is contained in:
SuriyaR 2019-08-13 16:10:46 +05:30
commit 52da3819a4

View File

@ -1235,54 +1235,70 @@ export class BlockchainBlockController {
next(err_msg); next(err_msg);
}); });
} }
let date = [], // let date = [],
DifficultyCuckatoo = [], // DifficultyCuckatoo = [],
DifficultyProgpow = [], // DifficultyProgpow = [],
DifficultyRandomx = []; // DifficultyRandomx = [];
TotalDifficultyNBlockQuery.forEach(e => { var DifficultyCuckatoo = TotalDifficultyNBlockQuery.map(function (e) {
date.push(moment(e.date).format(dateFormat)); return parseInt(e.total_difficulty_cuckatoo);
DifficultyCuckatoo.push(parseInt(e.total_difficulty_cuckatoo));
DifficultyProgpow.push(parseInt(e.total_difficulty_progpow));
DifficultyRandomx.push(parseInt(e.total_difficulty_randomx));
}); });
var Maxrange;
var Minrange; var DifficultyProgpow = TotalDifficultyNBlockQuery.map(function (e) {
if(alog_type == "cuckatoo"){ return parseInt(e.total_difficulty_progpow);
Maxrange = Math.max.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_cuckatoo; })); });
Minrange = Math.min.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_cuckatoo; }));
if(Minrange != 0){ var DifficultyRandomx = TotalDifficultyNBlockQuery.map(function (e) {
Minrange = (Minrange - (Minrange * 0.2)); return parseInt(e.total_difficulty_randomx);
} });
Maxrange = (Maxrange + (Maxrange * 0.2));
}else if(alog_type == "progpow"){ var date = TotalDifficultyNBlockQuery.map(function (e) {
Maxrange = Math.max.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_progpow; })); return moment(e.date).format(dateFormat);
Minrange = Math.min.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_progpow; })); });
if(Minrange != 0){
Minrange = (Minrange - (Minrange * 0.2)); // TotalDifficultyNBlockQuery.forEach(e => {
} // date.push(moment(e.date).format(dateFormat));
Maxrange = (Maxrange + (Maxrange * 0.2)); // DifficultyCuckatoo.push(parseInt(e.total_difficulty_cuckatoo));
}else if(alog_type == "randomx"){ // DifficultyProgpow.push(parseInt(e.total_difficulty_progpow));
Maxrange = Math.max.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_randomx; })); // DifficultyRandomx.push(parseInt(e.total_difficulty_randomx));
Minrange = Math.min.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_randomx; })); // });
if(Minrange != 0){ // var Maxrange;
Minrange = (Minrange - (Minrange * 0.2)); // var Minrange;
} // if(alog_type == "cuckatoo"){
Maxrange = (Maxrange + (Maxrange * 0.2)); // Maxrange = Math.max.apply(Math, DifficultyCuckatoo);
}else{ // Minrange = Math.min.apply(Math, DifficultyCuckatoo);
var Maxrange1 = Math.max.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_cuckatoo; })); // if(Minrange != 0){
var Minrange1 = Math.min.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_cuckatoo; })); // Minrange = (Minrange - (Minrange * 0.2));
var Maxrange2 = Math.max.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_progpow; })); // }
var Minrange2 = Math.min.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_progpow; })); // Maxrange = (Maxrange + (Maxrange * 0.2));
var Maxrange3 = Math.max.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_randomx; })); // }else if(alog_type == "progpow"){
var Minrange3 = Math.min.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_randomx; })); // Maxrange = Math.max.apply(Math, DifficultyProgpow);
Maxrange = Math.max(Maxrange1, Maxrange2, Maxrange3); // Minrange = Math.min.apply(Math, DifficultyProgpow);
Minrange = Math.min(Minrange1, Minrange2, Minrange3); // if(Minrange != 0){
if(Minrange != 0){ // Minrange = (Minrange - (Minrange * 0.2));
Minrange = (Minrange - (Minrange * 0.2)); // }
} // Maxrange = (Maxrange + (Maxrange * 0.2));
Maxrange = (Maxrange + (Maxrange * 0.2)); // }else if(alog_type == "randomx"){
} // Maxrange = Math.max.apply(Math, DifficultyRandomx);
// Minrange = Math.min.apply(Math, DifficultyRandomx);
// if(Minrange != 0){
// Minrange = (Minrange - (Minrange * 0.2));
// }
// Maxrange = (Maxrange + (Maxrange * 0.2));
// }else{
// var Maxrange1 = Math.max.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_cuckatoo; }));
// var Minrange1 = Math.min.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_cuckatoo; }));
// var Maxrange2 = Math.max.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_progpow; }));
// var Minrange2 = Math.min.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_progpow; }));
// var Maxrange3 = Math.max.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_randomx; }));
// var Minrange3 = Math.min.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_randomx; }));
// Maxrange = Math.max(Maxrange1, Maxrange2, Maxrange3);
// Minrange = Math.min(Minrange1, Minrange2, Minrange3);
// if(Minrange != 0){
// Minrange = (Minrange - (Minrange * 0.2));
// }
// Maxrange = (Maxrange + (Maxrange * 0.2));
// }
// Minrange = parseInt(Minrange); // Minrange = parseInt(Minrange);
// var Minrange2 = parseInt(Minrange * 0.3); // var Minrange2 = parseInt(Minrange * 0.3);
@ -1295,8 +1311,8 @@ export class BlockchainBlockController {
DifficultyCuckatoo: DifficultyCuckatoo, DifficultyCuckatoo: DifficultyCuckatoo,
DifficultyRandomx: DifficultyRandomx, DifficultyRandomx: DifficultyRandomx,
DifficultyProgpow: DifficultyProgpow, DifficultyProgpow: DifficultyProgpow,
Maxrange: Maxrange, //Maxrange: Maxrange,
Minrange: Minrange, //Minrange: Minrange,
tickFormat: tickFormat tickFormat: tickFormat
}, },
}); });