From 6908ff36e4a7df67192460dd77329f27c91eab06 Mon Sep 17 00:00:00 2001 From: kremsy Date: Fri, 12 May 2017 22:11:20 +0200 Subject: [PATCH] performance improve --- core/Statistics/SimpleStatsList.php | 9 +++++---- core/Statistics/StatisticManager.php | 6 +++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/core/Statistics/SimpleStatsList.php b/core/Statistics/SimpleStatsList.php index 52188ea7..c5771b27 100644 --- a/core/Statistics/SimpleStatsList.php +++ b/core/Statistics/SimpleStatsList.php @@ -73,10 +73,11 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener, $itemQuad->setSubStyle($itemQuad::SUBSTYLE_Stats); $itemQuad->setAction(self::ACTION_OPEN_STATSLIST); $this->maniaControl->getActionsMenu()->addMenuItem($itemQuad, true, 14, 'Open Statistics'); - + //TODO Chunking + //TODO settings if a stat get shown $this->registerStat(PlayerManager::STAT_SERVERTIME, 10, "ST", 20, StatisticManager::STAT_TYPE_TIME); - $this->registerStat(StatisticCollector::STAT_ON_HIT, 20, "H"); + $this->registerStat(StatisticCollector::STAT_ARROW_HIT, 20, "H"); $this->registerStat(StatisticCollector::STAT_ON_NEARMISS, 30, "NM"); $this->registerStat(StatisticCollector::STAT_ON_KILL, 40, "K"); $this->registerStat(StatisticCollector::STAT_ON_DEATH, 50, "D"); @@ -128,6 +129,7 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener, $quadSubstyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultMainWindowSubStyle(); + $order = StatisticCollector::STAT_ARROW_HIT; $maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID); $width = $this->statsWidth + 60; //TODO handle size when stats are empty @@ -211,7 +213,6 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener, } -$i = 0; foreach ($statRankings[$order] as $playerId => $value) { if ($index % self::MAX_PLAYERS_PER_PAGE === 1) { $pageFrame = new Frame(); @@ -264,7 +265,7 @@ $i = 0; } $labelLine->addLabelEntryText($index, $xStart + 5, 9); - $labelLine->addLabelEntryText($listPlayer->nickname, $xStart + 14, 41); + $labelLine->addLabelEntryText($listPlayer->login, $xStart + 14, 41); $labelLine->render(); $playerFrame->setY($posY); diff --git a/core/Statistics/StatisticManager.php b/core/Statistics/StatisticManager.php index 5622f81a..2ff85962 100644 --- a/core/Statistics/StatisticManager.php +++ b/core/Statistics/StatisticManager.php @@ -202,7 +202,7 @@ class StatisticManager implements UsageInformationAble { * @internal param $orderedBy * @return array */ - public function getStatsRanking($statName = '', $serverIndex = -1, $minValue = -1, $limit = 500) { + public function getStatsRanking($statName = '', $serverIndex = -1, $minValue = -1, $limit = 200) { if (isset($this->specialStats[$statName])) { return $this->getStatsRankingOfSpecialStat($statName, $serverIndex, $limit); } @@ -218,7 +218,7 @@ class StatisticManager implements UsageInformationAble { $query .= "ORDER BY `value` DESC"; if ($limit > 0) { - $query .= " LIMIT 500"; + $query .= " LIMIT " . $limit; } $query .= ";"; @@ -256,7 +256,7 @@ class StatisticManager implements UsageInformationAble { * @param int $limit * @return array */ - public function getStatsRankingOfSpecialStat($statName = '', $serverIndex = -1, $limit = 500) { + public function getStatsRankingOfSpecialStat($statName = '', $serverIndex = -1, $limit = 200) { $statsArray = array(); switch ($statName) { case self::SPECIAL_STAT_KD_RATIO: