瀏覽代碼

Fix stats page

Jordi Boggiano 6 年之前
父節點
當前提交
fa9e1dc817
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      src/Packagist/WebBundle/Controller/WebController.php

+ 2 - 2
src/Packagist/WebBundle/Controller/WebController.php

@@ -230,12 +230,12 @@ class WebController extends Controller
         $count = 0;
         foreach ($packages as $dataPoint) {
             $count += $dataPoint['count'];
-            $chart['packages'][$dataPoint['year'] . '-' . $dataPoint['month']] = $count;
+            $chart['packages'][$dataPoint['year'] . '-' . str_pad($dataPoint['month'], 2, '0', STR_PAD_LEFT)] = $count;
         }
 
         $count = 0;
         foreach ($versions as $dataPoint) {
-            $yearMonth = $dataPoint['year'] . '-' . $dataPoint['month'];
+            $yearMonth = $dataPoint['year'] . '-' . str_pad($dataPoint['month'], 2, '0', STR_PAD_LEFT);
             $count += $dataPoint['count'];
             if (in_array($yearMonth, $chart['months'])) {
                 $chart['versions'][$yearMonth] = $count;