From b85a47ac508ed83f15a9f0993f540f494de459c6 Mon Sep 17 00:00:00 2001 From: iAmShorty Date: Wed, 5 Mar 2014 16:21:23 +0100 Subject: [PATCH] [UPDATE] dashboard fixes, disable tickerupdate in cron/dashboard --- cronjobs/tickerupdate.php | 22 +++++++++++++------ public/include/smarty_globals.inc.php | 1 + public/site_assets/bootstrap/css/mpos.css | 2 -- .../bootstrap/dashboard/account_data.tpl | 0 .../templates/bootstrap/dashboard/js_api.tpl | 6 +++++ .../bootstrap/dashboard/overview.tpl | 8 ++++--- .../bootstrap/dashboard/round_stats.tpl | 2 +- 7 files changed, 28 insertions(+), 13 deletions(-) mode change 100644 => 100755 public/templates/bootstrap/dashboard/account_data.tpl mode change 100644 => 100755 public/templates/bootstrap/dashboard/round_stats.tpl diff --git a/cronjobs/tickerupdate.php b/cronjobs/tickerupdate.php index 7d25abf5..0075a260 100755 --- a/cronjobs/tickerupdate.php +++ b/cronjobs/tickerupdate.php @@ -33,18 +33,26 @@ $log->logInfo('Running periodic tasks to update database values for GUI access') $strLogMask = "| %-25.25s | %15.15s | %8.8s | %-6.6s | %-80.80s |"; $log->logInfo(sprintf($strLogMask, 'Method', 'Value', 'Runtime', 'Status', 'Message')); +empty($config['price']['enabled']) ? $tickerupdate = false : $tickerupdate = $config['price']['enabled']; + // Fetch latest coin price via API call $start = microtime(true); -$message = 'Updated latest ' . $config['currency'] . ' price from ' . $config['price']['url'] . ' API'; -$status = 'OK'; -if ($price = $tools->getPrice()) { - if (!$setting->setValue('price', $price)) { - $message = 'Unable to store new price value: ' . $setting->getCronError(); +if ($tickerupdate) { + $message = 'Updated latest ' . $config['currency'] . ' price from ' . $config['price']['url'] . ' API'; + $status = 'OK'; + if ($price = $tools->getPrice()) { + if (!$setting->setValue('price', $price)) { + $message = 'Unable to store new price value: ' . $setting->getCronError(); + $status = 'ERROR'; + } + } else { + $message = 'Failed to fetch price from API: ' . $tools->getCronError(); $status = 'ERROR'; } } else { - $message = 'Failed to fetch price from API: ' . $tools->getCronError(); - $status = 'ERROR'; + $message = 'Tickerupdate is disabled'; + $status = 'OK'; + $price = 0; } $log->logInfo(sprintf($strLogMask, 'Price Update', $price, number_format(microtime(true) - $start, 3), $status, $message)); diff --git a/public/include/smarty_globals.inc.php b/public/include/smarty_globals.inc.php index 19e3fd78..e79f98aa 100755 --- a/public/include/smarty_globals.inc.php +++ b/public/include/smarty_globals.inc.php @@ -83,6 +83,7 @@ $aGlobal = array( 'statistics_ajax_refresh_interval' => $statistics_ajax_refresh_interval, 'statistics_ajax_long_refresh_interval' => $statistics_ajax_long_refresh_interval, 'price' => array( 'currency' => $config['price']['currency'] ), + 'tickerupdate' => array( 'enabled' => $config['price']['enabled'] ), 'targetdiff' => $config['difficulty'], 'currency' => $config['currency'], 'txfee_manual' => $config['txfee_manual'], diff --git a/public/site_assets/bootstrap/css/mpos.css b/public/site_assets/bootstrap/css/mpos.css index c8341d11..4b6f7245 100755 --- a/public/site_assets/bootstrap/css/mpos.css +++ b/public/site_assets/bootstrap/css/mpos.css @@ -323,5 +323,3 @@ table.dataTable thead .sorting:after { .borderless > tbody > tr > td { border: none; } - - \ No newline at end of file diff --git a/public/templates/bootstrap/dashboard/account_data.tpl b/public/templates/bootstrap/dashboard/account_data.tpl old mode 100644 new mode 100755 diff --git a/public/templates/bootstrap/dashboard/js_api.tpl b/public/templates/bootstrap/dashboard/js_api.tpl index da861772..110e7679 100755 --- a/public/templates/bootstrap/dashboard/js_api.tpl +++ b/public/templates/bootstrap/dashboard/js_api.tpl @@ -37,7 +37,9 @@ $(document).ready(function(){ $('.personal-sharerate-bar').sparkline(storedPersonalSharerate, sparklineBarOptions); $('.pool-hashrate-bar').sparkline(storedPoolHashrate, sparklineBarOptions); $('.pool-workers-bar').sparkline(storedPoolWorkers, sparklineBarOptions); +{/literal}{if $config.tickerupdate.enabled}{literal} $('.coin-price-line').sparkline(storedCoinPrice, sparklineLineOptions); +{/literal}{/if}{literal} function refreshInformation(data) { // Drop one value, add the latest new one to each array @@ -56,12 +58,16 @@ $(document).ready(function(){ $('.personal-sharerate-bar').sparkline(storedPersonalSharerate, sparklineBarOptions); $('.pool-hashrate-bar').sparkline(storedPoolHashrate, sparklineBarOptions); $('.pool-workers-bar').sparkline(storedPoolWorkers, sparklineBarOptions); +{/literal}{if $config.tickerupdate.enabled}{literal} $('.coin-price-line').sparkline(storedCoinPrice, sparklineLineOptions); +{/literal}{/if}{literal} } // Refresh other static numbers on the template function refreshStaticData(data) { +{/literal}{if $config.tickerupdate.enabled}{literal} $('#b-price').html((parseFloat(data.getdashboarddata.data.pool.price).toFixed(8))); +{/literal}{/if}{literal} $('#b-poolworkers').html(data.getdashboarddata.data.pool.workers); $('#b-hashrate').html((parseFloat(data.getdashboarddata.data.personal.hashrate).toFixed(2))); $('#b-poolhashrate').html((parseFloat(data.getdashboarddata.data.pool.hashrate).toFixed(2))); diff --git a/public/templates/bootstrap/dashboard/overview.tpl b/public/templates/bootstrap/dashboard/overview.tpl index 9b028470..c50bf1c1 100755 --- a/public/templates/bootstrap/dashboard/overview.tpl +++ b/public/templates/bootstrap/dashboard/overview.tpl @@ -3,8 +3,8 @@

Overview

-
-
+
+

My Hashrate {$GLOBAL.hashunits.personal}

{$GLOBAL.userdata.hashrate|number_format:"2"} @@ -29,13 +29,15 @@
+ {if $GLOBAL.config.tickerupdate.enabled}

{$GLOBAL.config.currency}/{$GLOBAL.config.price.currency}

{$GLOBAL.price|default:"0"|number_format:"8"}
-
+ {/if} +