From 8c0fa26cd43f95c3e4ff69be099a0b0fc652ca35 Mon Sep 17 00:00:00 2001 From: kremsy Date: Sun, 2 Feb 2014 19:59:42 +0100 Subject: [PATCH] statslistfix --- application/core/Statistics/SimpleStatsList.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/application/core/Statistics/SimpleStatsList.php b/application/core/Statistics/SimpleStatsList.php index 5e6a1761..779d3708 100644 --- a/application/core/Statistics/SimpleStatsList.php +++ b/application/core/Statistics/SimpleStatsList.php @@ -114,6 +114,7 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener, $maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID); $script = $maniaLink->getScript(); $width = $this->statsWidth + 60; + //TODO handle size when stats are empty // Main frame $frame = new Frame(); @@ -157,16 +158,18 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener, $array['$oId'] = $x + 5; $array['$oNickname'] = $x + 14; - $x = $xStart + 55; - //Display Head + //Compute Headline + $x = $xStart + 55; $statRankings = array(); - foreach($this->statArray as $stat) { + foreach($this->statArray as $key => $stat) { $ranking = $this->maniaControl->statisticManager->getStatsRanking($stat["Name"]); if (!empty($ranking)) { $statRankings[$stat["Name"]] = $ranking; $array[$stat['HeadShortCut']] = $x; $x += $stat["Width"]; + }else{ + unset($this->statArray[$key]); } }