Skip to content

Commit

Permalink
Merge pull request #2442 from CachetHQ/fix
Browse files Browse the repository at this point in the history
Fixed scoping screw ups
  • Loading branch information
jbrooksuk authored Mar 19, 2017
2 parents f743574 + f4449d4 commit 17a0294
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions app/Integrations/Core/System.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand All @@ -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';
}

Expand Down

0 comments on commit 17a0294

Please sign in to comment.