From a8a956f2bc81518a5e520a9d873974239f041fe2 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Thu, 26 Jul 2018 12:22:51 +0100 Subject: [PATCH] update confirmations calculation on block list page --- src/Controller/MainController.php | 6 +++++- src/Template/Main/blocks.ctp | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Controller/MainController.php b/src/Controller/MainController.php index 807089f..42e6443 100644 --- a/src/Controller/MainController.php +++ b/src/Controller/MainController.php @@ -402,7 +402,11 @@ class MainController extends AppController { } $offset = ($page - 1) * $pageLimit; - $blocks = $this->Blocks->find()->offset($offset)->limit($pageLimit)->order(['Height' => 'DESC'])->toArray(); + $currentBlock = $this->Blocks->find()->select(['Height'])->order(['Height' => 'DESC'])->first(); + $blocks = $this->Blocks->find()->select( + ['Height', 'Difficulty', 'TransactionHashes', 'BlockSize', 'Nonce', 'BlockTime'] + )->offset($offset)->limit($pageLimit)->order(['Height' => 'DESC'])->toArray(); + $this->set('currentBlock', $currentBlock); $this->set('blocks', $blocks); $this->set('pageLimit', $pageLimit); $this->set('numPages', $numPages); diff --git a/src/Template/Main/blocks.ctp b/src/Template/Main/blocks.ctp index a804c16..b662378 100644 --- a/src/Template/Main/blocks.ctp +++ b/src/Template/Main/blocks.ctp @@ -412,7 +412,7 @@ Height ?> Difficulty, 8, '.', '') ?> - Confirmations, 0, '', ',') ?> + Height - $block->Height) + 1), 0, '', ',') ?> TransactionHashes)) ?> BlockSize / 1024, 2) . 'KB' ?> Nonce ?>