Add new "last updated date" settings
-Added new configurable settings to allow displaying a "last updated date" timestamp for: index, reward, masternode, movement, network, richlist and market pages -Affected pages are now configured to be completely hidden and disabled when their display settings are set to false
This commit is contained in:
+47
-8
@@ -759,10 +759,12 @@ module.exports = {
|
||||
return cb(distribution);
|
||||
});
|
||||
},
|
||||
|
||||
// updates heavy stats for coin
|
||||
// height: current block height, count: amount of votes to store
|
||||
update_heavy: function(coin, height, count, cb) {
|
||||
var newVotes = [];
|
||||
|
||||
lib.get_maxmoney( function (maxmoney) {
|
||||
lib.get_maxvote( function (maxvote) {
|
||||
lib.get_vote( function (vote) {
|
||||
@@ -773,14 +775,13 @@ module.exports = {
|
||||
lib.get_nextin( function (nextin) {
|
||||
lib.syncLoop(count, function (loop) {
|
||||
var i = loop.iteration();
|
||||
lib.get_blockhash(height-i, function (hash) {
|
||||
lib.get_blockhash(height - i, function (hash) {
|
||||
lib.get_block(hash, function (block) {
|
||||
newVotes.push({count:height-i,reward:block.reward,vote:(block && block.vote ? block.vote : 0)});
|
||||
newVotes.push({ count: height - i, reward: block.reward, vote: (block && block.vote ? block.vote : 0) });
|
||||
loop.next();
|
||||
});
|
||||
});
|
||||
}, function(){
|
||||
console.log(newVotes);
|
||||
}, function() {
|
||||
Heavy.updateOne({coin: coin}, {
|
||||
lvote: (vote ? vote : 0),
|
||||
reward: (reward ? reward : 0),
|
||||
@@ -790,10 +791,13 @@ module.exports = {
|
||||
phase: (phase ? phase : 'N/A'),
|
||||
maxvote: (maxvote ? maxvote : 0),
|
||||
nextin: (nextin ? nextin : 'N/A'),
|
||||
votes: newVotes,
|
||||
votes: newVotes
|
||||
}, function() {
|
||||
//console.log('address updated: %s', hash);
|
||||
return cb();
|
||||
// update reward_last_updated value
|
||||
module.exports.update_last_updated_stats(settings.coin, { reward_last_updated: Math.floor(new Date() / 1000) }, function (new_cb) {
|
||||
console.log('heavy update complete');
|
||||
return cb();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1195,13 +1199,48 @@ module.exports = {
|
||||
|
||||
// updates last_updated stats; called by sync.js
|
||||
update_last_updated_stats: function (coin, param, cb) {
|
||||
if (param.masternodes_last_updated) {
|
||||
if (param.blockchain_last_updated) {
|
||||
// update blockchain last updated date
|
||||
Stats.updateOne({ coin: coin }, {
|
||||
blockchain_last_updated: param.blockchain_last_updated
|
||||
}, function () {
|
||||
return cb(true);
|
||||
});
|
||||
} else if (param.reward_last_updated) {
|
||||
// update reward last updated date
|
||||
Stats.updateOne({ coin: coin }, {
|
||||
reward_last_updated: param.reward_last_updated
|
||||
}, function () {
|
||||
return cb(true);
|
||||
});
|
||||
} else if (param.masternodes_last_updated) {
|
||||
// update masternode last updated date
|
||||
Stats.updateOne({ coin: coin }, {
|
||||
masternodes_last_updated: param.masternodes_last_updated
|
||||
}, function () {
|
||||
return cb(true);
|
||||
});
|
||||
} else if (param.network_last_updated) {
|
||||
// update network last updated date
|
||||
Stats.updateOne({ coin: coin }, {
|
||||
network_last_updated: param.network_last_updated
|
||||
}, function () {
|
||||
return cb(true);
|
||||
});
|
||||
} else if (param.richlist_last_updated) {
|
||||
// update richlist last updated date
|
||||
Stats.updateOne({ coin: coin }, {
|
||||
richlist_last_updated: param.richlist_last_updated
|
||||
}, function () {
|
||||
return cb(true);
|
||||
});
|
||||
} else if (param.markets_last_updated) {
|
||||
// update markets last updated date
|
||||
Stats.updateOne({ coin: coin }, {
|
||||
markets_last_updated: param.markets_last_updated
|
||||
}, function () {
|
||||
return cb(true);
|
||||
});
|
||||
} else {
|
||||
// invalid option
|
||||
return cb(false);
|
||||
|
||||
@@ -140,12 +140,50 @@ exports.movement = {
|
||||
|
||||
//index
|
||||
exports.index = {
|
||||
// show_last_updated: determine whether to show a label above the transaction data with the last updated date
|
||||
"show_last_updated": true,
|
||||
"show_hashrate": false,
|
||||
"difficulty": "POS",
|
||||
"last_txs": 100,
|
||||
"txs_per_page": 10
|
||||
};
|
||||
|
||||
// reward page
|
||||
exports.reward_page = {
|
||||
// show_last_updated: determine whether to show a label above the reward data with the last updated date
|
||||
"show_last_updated": true
|
||||
};
|
||||
|
||||
// masternodes page
|
||||
exports.masternodes_page = {
|
||||
// show_last_updated: determine whether to show a label above the masternode data with the last updated date
|
||||
"show_last_updated": true
|
||||
};
|
||||
|
||||
// movement page
|
||||
exports.movement_page = {
|
||||
// show_last_updated: determine whether to show a label above the movement data with the last updated date
|
||||
"show_last_updated": true
|
||||
};
|
||||
|
||||
// network page
|
||||
exports.network_page = {
|
||||
// show_last_updated: determine whether to show a label above the network data with the last updated date
|
||||
"show_last_updated": true
|
||||
};
|
||||
|
||||
// richlist page
|
||||
exports.richlist_page = {
|
||||
// show_last_updated: determine whether to show a label above the richlist data with the last updated date
|
||||
"show_last_updated": true
|
||||
};
|
||||
|
||||
// markets page
|
||||
exports.markets_page = {
|
||||
// show_last_updated: determine whether to show a label above the market data with the last updated date
|
||||
"show_last_updated": true
|
||||
};
|
||||
|
||||
// twitter, facebook, googleplus, bitcointalk, github, slack, discord, telegram, reddit, youtube, website
|
||||
exports.twitter = "your-twitter-username";
|
||||
exports.facebook = "your-facebook-username";
|
||||
|
||||
Reference in New Issue
Block a user