From 11a5357ea9fe324e3661eee0958fca2d561919c9 Mon Sep 17 00:00:00 2001 From: James Brooks Date: Wed, 18 Oct 2017 20:01:42 +0100 Subject: [PATCH] Fixes #2759 - Days now generate when only 1 --- app/Http/Controllers/StatusPageController.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/StatusPageController.php b/app/Http/Controllers/StatusPageController.php index 8a746d7d..a05df597 100644 --- a/app/Http/Controllers/StatusPageController.php +++ b/app/Http/Controllers/StatusPageController.php @@ -63,8 +63,8 @@ class StatusPageController extends AbstractApiController } } - $daysToShow = max(0, (int) Config::get('setting.app_incident_days', 0) - 1); - $incidentDays = range(0, $daysToShow); + $appIncidentDays = (int) Config::get('setting.app_incident_days', 1); + $incidentDays = array_pad([], $daysToShow, null); $allIncidents = Incident::where('visible', '>=', (int) !Auth::check())->whereBetween('occurred_at', [ $startDate->copy()->subDays($daysToShow)->format('Y-m-d').' 00:00:00', @@ -75,7 +75,7 @@ class StatusPageController extends AbstractApiController // Add in days that have no incidents if (Config::get('setting.only_disrupted_days') === false) { - foreach ($incidentDays as $i) { + foreach ($incidentDays as $i => $day) { $date = app(DateFactory::class)->make($startDate)->subDays($i); if (!isset($allIncidents[$date->toDateString()])) {