From fbfd5b8f39a310b248fa79e68804b406867c764e Mon Sep 17 00:00:00 2001 From: marcdeb1 Date: Tue, 18 Dec 2018 20:17:34 +0100 Subject: [PATCH] Price history db name --- src/Controller/MainController.php | 5 ++--- src/Shell/AuxShell.php | 2 +- src/Template/Main/blocks.ctp | 4 +++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Controller/MainController.php b/src/Controller/MainController.php index 141a682..44a43b1 100644 --- a/src/Controller/MainController.php +++ b/src/Controller/MainController.php @@ -597,7 +597,6 @@ class MainController extends AppController { $resultSet = []; $conn = ConnectionManager::get('default'); - // get avg block sizes for the time period $stmt = $conn->execute("SELECT AVG(block_size) AS AvgBlockSize, DATE_FORMAT(FROM_UNIXTIME(block_time), '$sqlDateFormat') AS TimePeriod " . "FROM block WHERE DATE_FORMAT(FROM_UNIXTIME(block_time), '$sqlDateFormat') >= ? GROUP BY TimePeriod ORDER BY TimePeriod ASC", [$start->format($dateFormat)]); @@ -611,8 +610,8 @@ class MainController extends AppController { // get avg prices - $conn = ConnectionManager::get('localdb'); - $stmt = $conn->execute("SELECT AVG(USD) AS AvgUSD, DATE_FORMAT(Created, '$sqlDateFormat') AS TimePeriod " . + $conn_local = ConnectionManager::get('localdb'); + $stmt = $conn_local->execute("SELECT AVG(USD) AS AvgUSD, DATE_FORMAT(Created, '$sqlDateFormat') AS TimePeriod " . "FROM PriceHistory WHERE DATE_FORMAT(Created, '$sqlDateFormat') >= ? GROUP BY TimePeriod ORDER BY TimePeriod ASC", [$start->format($dateFormat)]); $avgPrices = $stmt->fetchAll(\PDO::FETCH_OBJ); foreach ($avgPrices as $price) { diff --git a/src/Shell/AuxShell.php b/src/Shell/AuxShell.php index 2495a9c..cfb6f8f 100644 --- a/src/Shell/AuxShell.php +++ b/src/Shell/AuxShell.php @@ -127,7 +127,7 @@ class AuxShell extends Shell { public function pricehistory() { self::lock('pricehistory'); - $conn = ConnectionManager::get('default'); + $conn = ConnectionManager::get('localdb'); $redis = new \Predis\Client(Configure::read('Redis.Url')); try { diff --git a/src/Template/Main/blocks.ctp b/src/Template/Main/blocks.ctp index 9c8fb17..17ff11c 100644 --- a/src/Template/Main/blocks.ctp +++ b/src/Template/Main/blocks.ctp @@ -76,9 +76,11 @@
NameClaimRoot
name_claim_root ?>
+