recent changes

This commit is contained in:
SuriyaR 2019-08-09 13:29:55 +05:30
parent 4fc54b17f3
commit f190b9938b
7 changed files with 100 additions and 26 deletions

View File

@ -82,7 +82,7 @@ export class BlockchainBlockController {
return fee; return fee;
} }
dateDiff(date2) { dateDiff(date2, insec = false) {
var current_date = new Date(); var current_date = new Date();
// var current_date = new Date("Sat Apr 2 2018 15:04:00 GMT+0530 (IST)"); // var current_date = new Date("Sat Apr 2 2018 15:04:00 GMT+0530 (IST)");
@ -92,7 +92,7 @@ export class BlockchainBlockController {
var enddayrnd = Math.round(enddaydif); var enddayrnd = Math.round(enddaydif);
// if(enddayrnd < 1) { // if(enddayrnd < 1) {
var time = this.convertMinsToHrmin( var time = this.convertMinsToHrmin(
Math.abs(date2.getTime() - current_date.getTime()), Math.abs(date2.getTime() - current_date.getTime()),insec
); );
return time; return time;
// } else if(enddayrnd == 1) { // } else if(enddayrnd == 1) {
@ -118,8 +118,13 @@ export class BlockchainBlockController {
// return dateTimeDurationString; // return dateTimeDurationString;
// } // }
convertMinsToHrmin(millseconds) { convertMinsToHrmin(millseconds,insec) {
var seconds = Math.floor(millseconds / 1000); var seconds = Math.floor(millseconds / 1000);
if(insec){
let sec = Math.floor(millseconds / 1000);
return sec;
}
console.log('secnds djfhksjdfdsf',seconds);
var days = Math.floor(seconds / 86400); var days = Math.floor(seconds / 86400);
var hours = Math.floor((seconds % 86400) / 3600); var hours = Math.floor((seconds % 86400) / 3600);
var minutes = Math.floor(((seconds % 86400) % 3600) / 60); var minutes = Math.floor(((seconds % 86400) % 3600) / 60);
@ -1068,7 +1073,7 @@ export class BlockchainBlockController {
var timeIntervalQry = var timeIntervalQry =
"timestamp at time zone '" + "timestamp at time zone '" +
process.env.TIME_ZONE + process.env.TIME_ZONE +
"' > current_date - interval '30 days'"; "' > current_date - interval '1 day'";
} }
const BlockQuery = await getConnection() const BlockQuery = await getConnection()
.query( .query(
@ -1523,7 +1528,7 @@ export class BlockchainBlockController {
) => { ) => {
try { try {
let block_height = '', let block_height = '',
letest_block = '', letest_block,
letest_block_num = '', letest_block_num = '',
letest_block_duration = ''; letest_block_duration = '';
@ -1624,11 +1629,10 @@ export class BlockchainBlockController {
var coin_existence = height * 200; var coin_existence = height * 200;
} }
letest_block = moment(BlockchainLatestBlockQuery[0].timestamp).fromNow(); letest_block = this.dateDiff(BlockchainLatestBlockQuery[0].timestamp,true);
letest_block_num = letest_block.substr(0, letest_block.indexOf(' ')); // "72" console.log('letest_block letest_block letest_block !!!!!!!!!!!!!1',letest_block);
letest_block_duration = letest_block.substr( letest_block_num = letest_block; // "72"
letest_block.indexOf(' ') + 1, letest_block_duration = letest_block == 1 ? 'second ago' : 'seconds ago';
); // "tocirah sneab"
const SECOND_POW_EDGE_BITS = 29; const SECOND_POW_EDGE_BITS = 29;
const BASE_EDGE_BITS = 24; const BASE_EDGE_BITS = 24;

View File

@ -19,7 +19,7 @@
"BLOCKCHAIN_HEIGHT": "Blockchain Höhe", "BLOCKCHAIN_HEIGHT": "Blockchain Höhe",
"LATEST_BLOCK": "Letzter Block", "LATEST_BLOCK": "Letzter Block",
"LATEST_BLOCK1": "Aktuelle Schwierigkeit", "LATEST_BLOCK1": "Aktuelle Schwierigkeit",
"COIN_IN": "Münzen in Existenz", "COIN_IN": "Zirkulierende Versorgung",
"HEIGHT": "Höhe", "HEIGHT": "Höhe",
"HASH": "Hash", "HASH": "Hash",
"AGE": "Alter", "AGE": "Alter",
@ -51,7 +51,7 @@
"DAYS" : "Tage", "DAYS" : "Tage",
"MONTHS" : "Monate", "MONTHS" : "Monate",
"WEEK" : "Woche", "WEEK" : "Woche",
"SEARCH_TEXT" : "Suche nach Hash oder Höhe", "SEARCH_TEXT" : "Suche nach Adresse, Hash oder Blockhöhe",
"BLOCK_REWARD" : "Block Belohnung", "BLOCK_REWARD" : "Block Belohnung",
"NOT_FOUND" : "Seite nicht gefunden", "NOT_FOUND" : "Seite nicht gefunden",
"NOT_FOUND1" : "Die von Ihnen gesuchte Seite wurde nicht gefunden", "NOT_FOUND1" : "Die von Ihnen gesuchte Seite wurde nicht gefunden",

View File

@ -19,7 +19,7 @@
"BLOCKCHAIN_HEIGHT": "Blockchain Height", "BLOCKCHAIN_HEIGHT": "Blockchain Height",
"LATEST_BLOCK": "Latest Block", "LATEST_BLOCK": "Latest Block",
"LATEST_BLOCK1": "Current Difficulty", "LATEST_BLOCK1": "Current Difficulty",
"COIN_IN": "Coins in Existence", "COIN_IN": "Circulating Supply",
"HEIGHT": "Height", "HEIGHT": "Height",
"HASH": "Hash", "HASH": "Hash",
"AGE": "Age", "AGE": "Age",
@ -51,7 +51,7 @@
"DAYS" : "days", "DAYS" : "days",
"MONTHS" : "months", "MONTHS" : "months",
"WEEK" : "week", "WEEK" : "week",
"SEARCH_TEXT" : "Search by hash or height", "SEARCH_TEXT" : "Search by address, hash, or block height",
"BLOCK_REWARD" : "Block Reward", "BLOCK_REWARD" : "Block Reward",
"NOT_FOUND" : "Page Not Found", "NOT_FOUND" : "Page Not Found",
"NOT_FOUND1" : "Page you are looking for is not found", "NOT_FOUND1" : "Page you are looking for is not found",

View File

@ -1,4 +1,5 @@
import { getConnection } from "typeorm"; import { getConnection } from "typeorm";
var moment = require("moment"); var moment = require("moment");
moment.updateLocale('en', { moment.updateLocale('en', {
relativeTime: { relativeTime: {
@ -18,10 +19,76 @@ moment.updateLocale('en', {
} }
}); });
function dateDiff(date2, insec = false) {
var current_date = new Date();
// var current_date = new Date("Sat Apr 2 2018 15:04:00 GMT+0530 (IST)");
var enddaydif =
Math.abs(date2.getTime() - current_date.getTime()) /
(1000 * 60 * 60 * 24);
var enddayrnd = Math.round(enddaydif);
// if(enddayrnd < 1) {
var time = convertMinsToHrmin(
Math.abs(date2.getTime() - current_date.getTime()),insec
);
return time;
// } else if(enddayrnd == 1) {
// return 'Ends in ' + enddayrnd + ' day';
// }else {
// return 'Ends in ' + enddayrnd + ' days';
// }
}
// convertMinsToHrmin(millseconds) {
// var seconds = Math.floor(millseconds / 1000);
// var days = Math.floor(seconds / 86400);
// var hours = Math.floor((seconds % 86400) / 3600);
// var minutes = Math.floor(((seconds % 86400) % 3600) / 60);
// var dateTimeDurationString = '';
// if ((days > 0) && (hours === 0 && minutes === 0)) dateTimeDurationString += (days > 1) ? (days + ' days ') : (days + ' day ');
// if ((days > 0) && (hours > 0 || minutes > 0)) dateTimeDurationString += (days > 1) ? (days + ' days, ') : (days + ' day, ');
// if ((hours > 0) && (minutes > 0)) dateTimeDurationString += (hours > 1) ? (hours + ' hours, ') : (hours + ' hour, ');
// if ((hours > 0) && (minutes === 0)) dateTimeDurationString += (hours > 1) ? (hours + ' hours ') : (hours + ' hour ');
// if (minutes > 0) dateTimeDurationString += (minutes > 1) ? (minutes + ' minutes ') : (minutes + ' minute ');
// if (seconds > 0) dateTimeDurationString += (seconds > 1) ? (minutes + ' seconds ') : (minutes + ' second ');
// return dateTimeDurationString;
// }
function convertMinsToHrmin(millseconds,insec) {
var seconds = Math.floor(millseconds / 1000);
if(insec){
let sec = Math.floor(millseconds / 1000);
return sec;
}
console.log('secnds djfhksjdfdsf',seconds);
var days = Math.floor(seconds / 86400);
var hours = Math.floor((seconds % 86400) / 3600);
var minutes = Math.floor(((seconds % 86400) % 3600) / 60);
seconds = seconds % 60;
var dateTimeDurationString = '';
if (days > 0 && (hours === 0 && minutes === 0))
dateTimeDurationString += days > 1 ? days + 'd ' : days + 'd ';
if (days > 0 && (hours > 0 || minutes > 0))
dateTimeDurationString += days > 1 ? days + 'd ' : days + 'd ';
if (hours > 0 && minutes > 0)
dateTimeDurationString += hours > 1 ? hours + 'h ' : hours + 'h ';
if (hours > 0 && minutes === 0)
dateTimeDurationString += hours > 1 ? hours + 'h ' : hours + 'h ';
if (minutes > 0)
dateTimeDurationString += minutes > 1 ? minutes + 'm ' : minutes + 'm ';
if (seconds > 0)
dateTimeDurationString += seconds > 1 ? seconds + 's ' : seconds + 's ';
return dateTimeDurationString;
}
export async function universalGetLatestBlockDetails(socket) { export async function universalGetLatestBlockDetails(socket) {
let block_height = "", let block_height = "",
letest_block = "", letest_block,
letest_block_num = "", letest_block_num = "",
letest_block_duration = ""; letest_block_duration = "";
@ -108,9 +175,9 @@ export async function universalGetLatestBlockDetails(socket) {
var coin_existence = height * 200; var coin_existence = height * 200;
} }
letest_block = moment(BlockchainLatestBlockQuery[0].timestamp).fromNow(); letest_block = dateDiff(BlockchainLatestBlockQuery[0].timestamp, true);
letest_block_num = letest_block.substr(0, letest_block.indexOf(" ")); // "72" letest_block_num = letest_block // "72"
letest_block_duration = letest_block.substr(letest_block.indexOf(" ") + 1); // "tocirah sneab" letest_block_duration = letest_block == 1 ? 'second ago' : 'seconds ago'; // "tocirah sneab"
const SECOND_POW_EDGE_BITS = 29; const SECOND_POW_EDGE_BITS = 29;
const BASE_EDGE_BITS = 24; const BASE_EDGE_BITS = 24;

View File

@ -17,7 +17,7 @@ export class TransServiceService {
if (isPlatformBrowser(this.platformId)) { if (isPlatformBrowser(this.platformId)) {
translate.addLangs(["en", "de"]); translate.addLangs(["en", "de"]);
translate.setDefaultLang("en"); translate.setDefaultLang("en");
this.langLabel = { en: "EN", de: "DE" }; this.langLabel = { en: "English", de: "German" };
// console.log('this.getCookie() ifconf',this.getCookie() != 'undefined' ? 1: 2); // console.log('this.getCookie() ifconf',this.getCookie() != 'undefined' ? 1: 2);
// console.log("(this.getCookie() && this.getCookie() != null) ? this.getCookie() : (this.getCurrentLang() && this.getCurrentLang() != null) ? this.getCurrentLang() : 'en'",(this.getCookie() && this.getCookie() != 'undefined') ? this.getCookie() : (this.getCurrentLang() && this.getCurrentLang() != 'undefined') ? this.getCurrentLang() : 'en'); // console.log("(this.getCookie() && this.getCookie() != null) ? this.getCookie() : (this.getCurrentLang() && this.getCurrentLang() != null) ? this.getCurrentLang() : 'en'",(this.getCookie() && this.getCookie() != 'undefined') ? this.getCookie() : (this.getCurrentLang() && this.getCurrentLang() != 'undefined') ? this.getCurrentLang() : 'en');
translate.use( translate.use(

View File

@ -197,21 +197,24 @@
</div> </div>
</div> </div>
<div class="day_filter"> <div class="day_filter">
<a href="JavaScript:void(0);" (click)="
blockreq('', '', '1 day'); selectedItem3 = 2
" id="2" #item32 [ngClass]="{ active: selectedItem3 == item32.id, txt_primay: true }">1 day</a>
<a href="JavaScript:void(0);" (click)=" <a href="JavaScript:void(0);" (click)="
blockreq('', '', '1 week'); selectedItem3 = 1 blockreq('', '', '1 week'); selectedItem3 = 1
" id="1" #item31 [ngClass]="{ active: selectedItem3 == item1.id, txt_primay: true }">1 {{'home.WEEK' | translate}}</a> " id="1" #item31 [ngClass]="{ active: selectedItem3 == item31.id, txt_primay: true }">1 {{'home.WEEK' | translate}}</a>
<a href="JavaScript:void(0);" (click)=" <!-- <a href="JavaScript:void(0);" (click)="
blockreq('', '', '15 days'); selectedItem3 = 2 blockreq('', '', '15 days'); selectedItem3 = 2
" id="2" #item32 [ngClass]="{ active: selectedItem3 == item2.id, day15_txt: true }">15 {{'home.DAYS' | translate}}</a> " id="2" #item32 [ngClass]="{ active: selectedItem3 == item2.id, day15_txt: true }">15 {{'home.DAYS' | translate}}</a> -->
<a href="JavaScript:void(0);" (click)=" <a href="JavaScript:void(0);" (click)="
blockreq('', '', '30 days'); selectedItem3 = 3 blockreq('', '', '30 days'); selectedItem3 = 3
" id="3" #item33 [ngClass]="{ active: selectedItem3 == item3.id, day30_txt: true }">30 {{'home.DAYS' | translate}}</a> " id="3" #item33 [ngClass]="{ active: selectedItem3 == item33.id, day30_txt: true }">30 {{'home.DAYS' | translate}}</a>
<a href="JavaScript:void(0);" (click)=" <a href="JavaScript:void(0);" (click)="
blockreq('', '', '60 days'); selectedItem3 = 4 blockreq('', '', '60 days'); selectedItem3 = 4
" id="4" #item34 [ngClass]="{ active: selectedItem3 == item4.id, day60_txt: true }">60 {{'home.DAYS' | translate}}</a> " id="4" #item34 [ngClass]="{ active: selectedItem3 == item34.id, day60_txt: true }">60 {{'home.DAYS' | translate}}</a>
<a href="JavaScript:void(0);" (click)=" <a href="JavaScript:void(0);" (click)="
blockreq('', '', '3 months'); selectedItem3 = 5 blockreq('', '', '3 months'); selectedItem3 = 5
" id="5" #item35 [ngClass]="{ active: selectedItem3 == item5.id, day3m_txt: true }">3 {{'home.MONTHS' | translate}}</a> " id="5" #item35 [ngClass]="{ active: selectedItem3 == item35.id, day3m_txt: true }">3 {{'home.MONTHS' | translate}}</a>
</div> </div>
<div class="explore_all text-right"> <div class="explore_all text-right">
<a routerLink="/chart/blocks"><span class="text-uppercase d-block">{{'home.EXPLORE_IT' | translate}} <i class="fa fa-long-arrow-right"></i></span></a> <a routerLink="/chart/blocks"><span class="text-uppercase d-block">{{'home.EXPLORE_IT' | translate}} <i class="fa fa-long-arrow-right"></i></span></a>

View File

@ -40,7 +40,7 @@ export class GraphListComponent implements OnInit {
public pg_last: any = ''; public pg_last: any = '';
public selectedItem: Number = 6; public selectedItem: Number = 6;
public selectedItem3: Number = 3; public selectedItem3: Number = 2;
public selectedItem2: Number = 3; public selectedItem2: Number = 3;
public selectedItem4: Number = 3; public selectedItem4: Number = 3;
public selectedItem5: Number = 3; public selectedItem5: Number = 3;