diff --git a/public/include/classes/statistics.class.php b/public/include/classes/statistics.class.php
index 650fa288..233e3580 100644
--- a/public/include/classes/statistics.class.php
+++ b/public/include/classes/statistics.class.php
@@ -52,6 +52,64 @@ class Statistics {
return true;
}
+
+
+
+
+ /**
+ * Fetch last found orphaned / valid
+ **/
+ function getBlockCountStatistics($aSearch) {
+ $this->debug->append("STA " . __METHOD__, 4);
+ if ($data = $this->memcache->get(__FUNCTION__ . $aSearch)) return $data;
+
+ if ($aSearch == 1)
+ {
+ $stmt = $this->mysqli->prepare("
+ SELECT COUNT(id) AS count FROM " . $this->block->getTableName() . "
+ WHERE confirmations > 0
+ ");
+ } else {
+ $stmt = $this->mysqli->prepare("
+ SELECT COUNT(id) AS count FROM " . $this->block->getTableName() . "
+ WHERE confirmations = -1
+ ");
+ }
+ if ($this->checkStmt($stmt) && $stmt->execute() && $result = $stmt->get_result())
+ if ($aSearch == 1) return $this->memcache->setCache(BLOCKSTATSVALID, $result->fetch_object()->count);
+ if ($aSearch == 0) return $this->memcache->setCache(BLOCKSTATSORPHAN, $result->fetch_object()->count);
+ $this->debug->append("Failed to get Blocks by time: ". $this->mysqli->error);
+ return false;
+ }
+
+
+
+
+
+ /**
+ * Fetch last found blocks by time
+ **/
+ function getLastFoundBlocksbyTime($aTimeFrame) {
+ $this->debug->append("STA " . __METHOD__, 4);
+ if ($data = $this->memcache->get(__FUNCTION__ . $aTimeFrame)) return $data;
+ $date = new DateTime();
+ $actualTime = $date->getTimestamp();
+ $aTimeDiff = $actualTime - $aTimeFrame;
+ $stmt = $this->mysqli->prepare("
+ SELECT COUNT(id) AS count FROM " . $this->block->getTableName() . "
+ WHERE time > ?
+ ");
+
+ if ($this->checkStmt($stmt) && $stmt->bind_param('i', $aTimeDiff) && $stmt->execute() && $result = $stmt->get_result())
+ if ($aTimeFrame == 3600) return $this->memcache->setCache(FOUNDLASTHOUR, $result->fetch_object()->count);
+ if ($aTimeFrame == 86400) return $this->memcache->setCache(FOUNDLAST24HOURS, $result->fetch_object()->count);
+ if ($aTimeFrame == 604800) return $this->memcache->setCache(FOUNDLAST7DAYS, $result->fetch_object()->count);
+ if ($aTimeFrame == 2419200) return $this->memcache->setCache(FOUNDLAST4WEEKS, $result->fetch_object()->count);
+ $this->debug->append("Failed to get Blocks by time: ". $this->mysqli->error);
+ return false;
+ }
+
+
/**
* Get our last $limit blocks found
* @param limit int Last limit blocks
diff --git a/public/include/pages/statistics/pool.inc.php b/public/include/pages/statistics/pool.inc.php
index 5416b984..d2dbf664 100644
--- a/public/include/pages/statistics/pool.inc.php
+++ b/public/include/pages/statistics/pool.inc.php
@@ -42,7 +42,25 @@ if (!$smarty->isCached('master.tpl', $smarty_cache_key)) {
$dTimeSinceLast = 0;
}
+ $iFoundLastHour = $statistics->getLastFoundBlocksbyTime(3600);
+ $iFoundLastDay = $statistics->getLastFoundBlocksbyTime(86400);
+ $iFoundLastWeek = $statistics->getLastFoundBlocksbyTime(604800);
+ $iFoundLastMonth = $statistics->getLastFoundBlocksbyTime(2419200);
+
+ $iFoundValidBlock = $statistics->getBlockCountStatistics(1);
+ $iFoundOrphanBlock = $statistics->getBlockCountStatistics(0);
+
// Propagate content our template
+
+ $smarty->assign("FOUNDLASTHOUR", $iFoundLastHour);
+ $smarty->assign("FOUNDLAST24HOURS", $iFoundLastDay);
+ $smarty->assign("FOUNDLAST7DAYS", $iFoundLastWeek);
+ $smarty->assign("FOUNDLAST4WEEKS", $iFoundLastMonth);
+
+ $smarty->assign("BLOCKSTATSVALID", $iFoundValidBlock);
+ $smarty->assign("BLOCKSTATSORPHAN", $iFoundOrphanBlock);
+
+ $smarty->assign("ESTTIME", $iEstTime);
$smarty->assign("ESTTIME", $iEstTime);
$smarty->assign("TIMESINCELAST", $dTimeSinceLast);
$smarty->assign("BLOCKSFOUND", $aBlocksFoundData);
diff --git a/public/templates/mmcFE/statistics/pool/default.tpl b/public/templates/mmcFE/statistics/pool/default.tpl
index de72be1f..d8d992e4 100644
--- a/public/templates/mmcFE/statistics/pool/default.tpl
+++ b/public/templates/mmcFE/statistics/pool/default.tpl
@@ -50,8 +50,28 @@
{assign var=estshares value=(65536 * $DIFFICULTY) / pow(2, ($GLOBAL.config.targetdiff - 16))}
{$estshares|number_format:"0"} (done: {(100 / $estshares * $GLOBAL.roundshares.valid)|number_format:"2"} %) |
-
-
+
+
+ | Found / Valid / Orphan
+ | {$BLOCKSTATSVALID + $BLOCKSTATSORPHAN} / {$BLOCKSTATSVALID} / {$BLOCKSTATSORPHAN} |
+
+
+ | Blocks found last hour
+ | {$FOUNDLASTHOUR} |
+
+
+ | Blocks found last 24 hours
+ | {$FOUNDLAST24HOURS} |
+
+
+ | Blocks found last 7 days
+ | {$FOUNDLAST7DAYS} |
+
+
+ | Blocks found last 4 weeks
+ | {$FOUNDLAST4WEEKS} |
+
+
| {$TIMESINCELAST|seconds_to_words} |
diff --git a/public/templates/mobile/statistics/pool/general_stats.tpl b/public/templates/mobile/statistics/pool/general_stats.tpl
index d4677f3a..c9a6f4ac 100644
--- a/public/templates/mobile/statistics/pool/general_stats.tpl
+++ b/public/templates/mobile/statistics/pool/general_stats.tpl
@@ -40,8 +40,28 @@
| {((65536 * $DIFFICULTY) / pow(2, ($GLOBAL.config.targetdiff - 16)))|number_format:"0"} (done: {(100 / ((65536 * $DIFFICULTY) / pow(2, ($GLOBAL.config.targetdiff - 16))) * $GLOBAL.roundshares.valid)|number_format:"2"} %) |
-
-
+
+
+ | Found / Valid / Orphan
+ | {$BLOCKSTATSVALID + $BLOCKSTATSORPHAN} / {$BLOCKSTATSVALID} / {$BLOCKSTATSORPHAN} |
+
+
+ | Blocks found last hour
+ | {$FOUNDLASTHOUR} |
+
+
+ | Blocks found last 24 hours
+ | {$FOUNDLAST24HOURS} |
+
+
+ | Blocks found last 7 days
+ | {$FOUNDLAST7DAYS} |
+
+
+ | Blocks found last 4 weeks
+ | {$FOUNDLAST4WEEKS} |
+
+
| {$TIMESINCELAST|seconds_to_words} |
diff --git a/public/templates/mpos/statistics/pool/general_stats.tpl b/public/templates/mpos/statistics/pool/general_stats.tpl
index c8619fe5..4a4f1619 100644
--- a/public/templates/mpos/statistics/pool/general_stats.tpl
+++ b/public/templates/mpos/statistics/pool/general_stats.tpl
@@ -1,4 +1,4 @@
-
+
@@ -46,6 +46,26 @@
| Est. Shares this Round
| |
+
+ | Found / Valid / Orphan
+ | {$BLOCKSTATSVALID + $BLOCKSTATSORPHAN} / {$BLOCKSTATSVALID} / {$BLOCKSTATSORPHAN} |
+
+
+ | Blocks found last hour
+ | {$FOUNDLASTHOUR} |
+
+
+ | Blocks found last 24 hours
+ | {$FOUNDLAST24HOURS} |
+
+
+ | Blocks found last 7 days
+ | {$FOUNDLAST7DAYS} |
+
+
+ | Blocks found last 4 weeks
+ | {$FOUNDLAST4WEEKS} |
+
| Time Since Last Block
| {$TIMESINCELAST|seconds_to_words} |