浏览代码

Show latest data for downloads instead of shifting by 2days

Jordi Boggiano 6 年之前
父节点
当前提交
08a1764727

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

@@ -255,11 +255,11 @@ class WebController extends Controller
             $downloads = $redis->get('downloads') ?: 0;
 
             $date = new \DateTime($downloadsStartDate.' 00:00:00');
-            $yesterday = new \DateTime('-2days 00:00:00');
-            $dailyGraphStart = new \DateTime('-32days 00:00:00'); // 30 days before yesterday
+            $today = new \DateTime('today 00:00:00');
+            $dailyGraphStart = new \DateTime('-30days 00:00:00'); // 30 days before today
 
             $dlChart = $dlChartMonthly = array();
-            while ($date <= $yesterday) {
+            while ($date <= $today) {
                 if ($date > $dailyGraphStart) {
                     $dlChart[$date->format('Y-m-d')] = 'downloads:'.$date->format('Ymd');
                 }

+ 1 - 0
src/Packagist/WebBundle/Resources/translations/messages.en.yml

@@ -117,6 +117,7 @@ statistics:
     title: Statistics
     over_time: Packages/versions over time
     last_partial: The last data point is for the current month and shows partial data.
+    last_partial_day: The last data point is for the current day (UTC) and shows partial data.
     last_month: Packages installed in the last 30 days
     monthly: Packages installed per month
     packages: Packages

+ 1 - 0
src/Packagist/WebBundle/Resources/views/Web/stats.html.twig

@@ -25,6 +25,7 @@
                         Sorry, the graph can't be displayed because your browser doesn't support &lt;svg&gt; html element.
                     </svg>
                 </p>
+                <p>{{ 'statistics.last_partial_day'|trans }}</p>
             {% endif %}
             {% if downloadsChartMonthly %}
                 <h3>{{ 'statistics.monthly'|trans }}</h3>