From 08a3200b7525fae2d06697e407e52f1cef1ee60d Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Sat, 8 Feb 2014 13:46:21 +0100 Subject: [PATCH] [FIX] Fallback to fixed reward without blocks --- public/include/classes/block.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/include/classes/block.class.php b/public/include/classes/block.class.php index ef0cdf7f..76ccf43d 100644 --- a/public/include/classes/block.class.php +++ b/public/include/classes/block.class.php @@ -246,7 +246,7 @@ class Block extends Base { * @param return mixed Block array or false **/ public function getAverageAmount($limit=10) { - $stmt = $this->mysqli->prepare("SELECT AVG(amount) as avg_amount FROM ( SELECT amount FROM $this->table ORDER BY id DESC LIMIT ?) AS t1"); + $stmt = $this->mysqli->prepare("SELECT IFNULL(AVG(amount), " . $this->config['reward'] . ") as avg_amount FROM ( SELECT amount FROM $this->table ORDER BY id DESC LIMIT ?) AS t1"); if ($this->checkStmt($stmt) && $stmt->bind_param('i', $limit) && $stmt->execute() && $result = $stmt->get_result()) { return $result->fetch_object()->avg_amount; } else {