From d67b36ad4200925756ad2b9d0e50b62bd2a2304b Mon Sep 17 00:00:00 2001 From: James Brooks Date: Mon, 24 Nov 2014 17:02:03 +0000 Subject: [PATCH] Cache the amount of incidents we have --- app/view-composers.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/view-composers.php b/app/view-composers.php index 8ca86171..3e78491a 100644 --- a/app/view-composers.php +++ b/app/view-composers.php @@ -7,7 +7,9 @@ ->groupBy('status') ->orderBy('status', 'desc'); - if ($incidents->get()->count() <= 1 || ($incidents->get()->count() > 1 && (int) $incidents->first()->status === 4)) { + $incidentCount = $incidents->count(); + + if ($incidentCount <= 1 || ($incidentCount > 1 && (int) $incidents->first()->status === 4)) { $status = 'success'; $message = 'All systems are functional.'; } else {