From f4449d40d4426b6f5bad22747d32fca6b61ac852 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sat, 18 Mar 2017 18:54:48 +0000 Subject: [PATCH] Fixed scoping screw ups Closes #2441. --- app/Integrations/Core/System.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/Integrations/Core/System.php b/app/Integrations/Core/System.php index 49851503b8b7..072b166ce444 100644 --- a/app/Integrations/Core/System.php +++ b/app/Integrations/Core/System.php @@ -49,9 +49,8 @@ public function __construct(Repository $config) */ public function getStatus() { - $enabledScope = Component::enabled(); - $totalComponents = (clone $enabledScope)->count(); - $majorOutages = (clone $enabledScope)->status(4)->count(); + $totalComponents = Component::enabled()->count(); + $majorOutages = Component::enabled()->status(4)->count(); $isMajorOutage = $totalComponents ? ($majorOutages / $totalComponents) >= 0.5 : false; // Default data @@ -67,7 +66,7 @@ public function getStatus() 'system_message' => trans_choice('cachet.service.major', $totalComponents), 'favicon' => 'favicon-high-alert', ]; - } elseif ($enabledScope->notStatus(1)->count() === 0) { + } elseif (Component::enabled()->notStatus(1)->count() === 0) { // If all our components are ok, do we have any non-fixed incidents? $incidents = Incident::orderBy('occurred_at', 'desc')->get()->filter(function ($incident) { return $incident->status !== Incident::FIXED; @@ -84,7 +83,7 @@ public function getStatus() 'favicon' => 'favicon', ]; } - } elseif ($enabledScope->whereIn('status', [2, 3])->count() > 0) { + } elseif (Component::enabled()->whereIn('status', [2, 3])->count() > 0) { $status['favicon'] = 'favicon-medium-alert'; }