mirror of
https://github.com/Retropex/custom-ocean.xyz-dashboard.git
synced 2025-05-13 03:30:46 +02:00
Improve log message formatting in logCurrentStats
Updated the `logCurrentStats` function to enhance the display of daily profit and unpaid earnings. Daily profit now defaults to '0.00' instead of 'CALCULATING...', and unpaid earnings are parsed as integers. Additionally, power consumption now shows '0 WATTS' instead of 'N/A W' when not available.
This commit is contained in:
parent
6c7e986a80
commit
13294b6d72
@ -254,16 +254,18 @@ function processLogQueue() {
|
|||||||
function logCurrentStats(metrics) {
|
function logCurrentStats(metrics) {
|
||||||
if (!metrics) return;
|
if (!metrics) return;
|
||||||
|
|
||||||
// Define an array of possible log messages
|
// Define an array of possible log messages with corrected formatting
|
||||||
const logMessages = [
|
const logMessages = [
|
||||||
`HASHRATE: ${metrics.hashrate_60sec || metrics.hashrate_10min || metrics.hashrate_3hr || 0} ${metrics.hashrate_60sec_unit || metrics.hashrate_10min_unit || metrics.hashrate_3hr_unit || 'TH/s'}`,
|
`HASHRATE: ${metrics.hashrate_60sec || metrics.hashrate_10min || metrics.hashrate_3hr || 0} ${metrics.hashrate_60sec_unit || metrics.hashrate_10min_unit || metrics.hashrate_3hr_unit || 'TH/s'}`,
|
||||||
`BLOCK HEIGHT: ${numberWithCommas(metrics.block_number || 0)}`,
|
`BLOCK HEIGHT: ${numberWithCommas(metrics.block_number || 0)}`,
|
||||||
`WORKERS ONLINE: ${metrics.workers_hashing || 0}`,
|
`WORKERS ONLINE: ${metrics.workers_hashing || 0}`,
|
||||||
`BTC PRICE: $${numberWithCommas(parseFloat(metrics.btc_price || 0).toFixed(2))}`,
|
`BTC PRICE: $${numberWithCommas(parseFloat(metrics.btc_price || 0).toFixed(2))}`,
|
||||||
`DAILY PROFIT: $${metrics.daily_profit_usd ? metrics.daily_profit_usd.toFixed(2) : 'CALCULATING...'}`,
|
`DAILY PROFIT: $${metrics.daily_profit_usd ? metrics.daily_profit_usd.toFixed(2) : '0.00'}`,
|
||||||
`UNPAID EARNINGS: ${numberWithCommas(metrics.unpaid_earnings || 0)} SATS`,
|
// Fix the unpaid earnings format to display as SATS correctly
|
||||||
|
`UNPAID EARNINGS: ${numberWithCommas(parseInt(metrics.unpaid_earnings || 0))} SATS`,
|
||||||
`NETWORK DIFFICULTY: ${numberWithCommas(Math.round(metrics.difficulty || 0))}`,
|
`NETWORK DIFFICULTY: ${numberWithCommas(Math.round(metrics.difficulty || 0))}`,
|
||||||
`POWER CONSUMPTION: ${metrics.power_usage || 'N/A'}W`,
|
// Fix power consumption to show 0W instead of N/AW when not available
|
||||||
|
`POWER CONSUMPTION: ${metrics.power_usage || '0'} WATTS`,
|
||||||
];
|
];
|
||||||
|
|
||||||
// Randomize the order of log messages
|
// Randomize the order of log messages
|
||||||
|
Loading…
Reference in New Issue
Block a user