From: Marcel Werk Date: Wed, 9 Jul 2014 15:01:25 +0000 (+0200) Subject: Fixed multiple issues in stathandler / statpage X-Git-Tag: 2.1.0_Alpha_1~598 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7652dbb0e2f3ece39b59e59eca6f575c0844a26b;p=GitHub%2FWoltLab%2FWCF.git Fixed multiple issues in stathandler / statpage --- diff --git a/wcfsetup/install/files/acp/js/WCF.ACP.js b/wcfsetup/install/files/acp/js/WCF.ACP.js index f0d7ae3949..cbb902846c 100644 --- a/wcfsetup/install/files/acp/js/WCF.ACP.js +++ b/wcfsetup/install/files/acp/js/WCF.ACP.js @@ -2612,6 +2612,10 @@ WCF.ACP.Stat.Chart = Class.extend({ $("#chartTooltip").hide(); } }); + + if (!$data.length) { + $('#chart').append('

' + WCF.Language.get('wcf.acp.stat.noData') + '

'); + } } }); diff --git a/wcfsetup/install/files/acp/templates/stat.tpl b/wcfsetup/install/files/acp/templates/stat.tpl index 71ba2ea6d9..2b89b22a15 100644 --- a/wcfsetup/install/files/acp/templates/stat.tpl +++ b/wcfsetup/install/files/acp/templates/stat.tpl @@ -9,7 +9,8 @@ 'wcf.acp.stat.timeFormat.daily': '{lang}wcf.acp.stat.timeFormat.daily{/lang}', 'wcf.acp.stat.timeFormat.weekly': '{lang}wcf.acp.stat.timeFormat.weekly{/lang}', 'wcf.acp.stat.timeFormat.monthly': '{lang}wcf.acp.stat.timeFormat.monthly{/lang}', - 'wcf.acp.stat.timeFormat.yearly': '{lang}wcf.acp.stat.timeFormat.yearly{/lang}' + 'wcf.acp.stat.timeFormat.yearly': '{lang}wcf.acp.stat.timeFormat.yearly{/lang}', + 'wcf.acp.stat.noData': '{lang}wcf.acp.stat.noData{/lang}' }); new WCF.ACP.Stat.Chart(); diff --git a/wcfsetup/install/files/lib/data/stat/daily/StatDailyAction.class.php b/wcfsetup/install/files/lib/data/stat/daily/StatDailyAction.class.php index c523bc5dd4..b9cf85ecc8 100644 --- a/wcfsetup/install/files/lib/data/stat/daily/StatDailyAction.class.php +++ b/wcfsetup/install/files/lib/data/stat/daily/StatDailyAction.class.php @@ -62,6 +62,7 @@ class StatDailyAction extends AbstractDatabaseObjectAction { $conditionBuilder->add('objectTypeID IN (?)', array($this->parameters['objectTypeIDs'])); $conditionBuilder->add('date BETWEEN ? AND ?', array($this->parameters['startDate'], $this->parameters['endDate'])); + $limit = 0; if ($this->parameters['dateGrouping'] == 'yearly') { $sql = "SELECT MIN(date) AS date, SUM(counter) AS counter, MAX(total) AS total, objectTypeID FROM wcf".WCF_N."_stat_daily @@ -82,15 +83,17 @@ class StatDailyAction extends AbstractDatabaseObjectAction { ".$conditionBuilder." GROUP BY EXTRACT(YEAR FROM date), EXTRACT(WEEK FROM date), objectTypeID ORDER BY date"; + $limit = 260; } else { $sql = "SELECT * FROM wcf".WCF_N."_stat_daily ".$conditionBuilder." ORDER BY date"; + $limit = 365; } - $statement = WCF::getDB()->prepareStatement($sql); + $statement = WCF::getDB()->prepareStatement($sql, $limit); $statement->execute($conditionBuilder->getParameters()); while ($row = $statement->fetchArray()) { $value = $row['counter']; diff --git a/wcfsetup/install/files/lib/system/worker/StatDailyRebuildDataWorker.class.php b/wcfsetup/install/files/lib/system/worker/StatDailyRebuildDataWorker.class.php index 6fd29d720e..c8c23cf75b 100644 --- a/wcfsetup/install/files/lib/system/worker/StatDailyRebuildDataWorker.class.php +++ b/wcfsetup/install/files/lib/system/worker/StatDailyRebuildDataWorker.class.php @@ -73,6 +73,8 @@ class StatDailyRebuildDataWorker extends AbstractRebuildDataWorker { $d->add(new \DateInterval('P'.($this->loopCount * $this->limit).'D')); } for ($i = 0; $i < $this->limit; $i++) { + if ($d->getTimestamp() > TIME_NOW) break; + // get object types foreach (ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.statDailyHandler') as $objectType) { $data = $objectType->getProcessor()->getData($d->getTimestamp()); diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index bad6fc0b4e..bce4a2a8e5 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -1237,6 +1237,7 @@ GmbH=Gesellschaft mit beschränkter Haftung]]> + diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index 1fbf1d3f16..99cd1d6de4 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -1206,6 +1206,7 @@ GmbH=Gesellschaft mit beschränkter Haftung]]> +