Skip to content
This repository was archived by the owner on Mar 30, 2024. It is now read-only.

Commit db4007b

Browse files
committed
Bugfix charts extension
1 parent fcd5654 commit db4007b

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

extensions/charts/index.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
"events" : {
55
"statsViewed" : "TTTCharts\\Charts::statsViewed"
66
},
7-
"version" : "v1.0.1"
7+
"version" : "v1.0.2"
88
}

extensions/charts/index.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,10 @@ private static function createBar(array $data) : string {
6969
$c = str_repeat("-", self::LINE_LENGTH+1) . PHP_EOL;
7070
$fullLength = 0;
7171
foreach($lengths as $name => $d){
72-
$c .= '|' . \str_pad($name, $d - 1, " ", STR_PAD_BOTH);
73-
$fullLength += $d < 1 ? 1 : $d;
72+
if( $d > 0){
73+
$c .= '|' . \str_pad($name, $d - 1, " ", STR_PAD_BOTH);
74+
$fullLength += $d < 1 ? 1 : $d;
75+
}
7476
}
7577
$c .= str_repeat(" ", self::LINE_LENGTH - $fullLength) . '|' . PHP_EOL;
7678
$c .= str_repeat("-", self::LINE_LENGTH+1);

0 commit comments

Comments
 (0)