From 9756f59a2ce4e7235c063df84202e3751d2a0713 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 6 May 2016 15:56:01 -0400 Subject: [PATCH] still trying to fix eventcounts --- web/skins/classic/views/console.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/web/skins/classic/views/console.php b/web/skins/classic/views/console.php index dfce5bf91..22827e9b7 100644 --- a/web/skins/classic/views/console.php +++ b/web/skins/classic/views/console.php @@ -88,7 +88,7 @@ for( $i = 0; $i < count($displayMonitors); $i += 1 ) { $monitor['zma'] = zmaStatus( $monitor ); $monitor['ZoneCount'] = dbFetchOne( 'select count(Id) as ZoneCount from Zones where MonitorId = ?', 'ZoneCount', array($monitor['Id']) ); $counts = array(); - for ( $j = 0; $j < count($eventCounts); $j++ ) { + for ( $j = 0; $j < count($eventCounts); $j += 1 ) { $filter = addFilterTerm( $eventCounts[$j]['filter'], count($eventCounts[$j]['filter']['terms']), array( "cnj" => "and", "attr" => "MonitorId", "op" => "=", "val" => $monitor['Id'] ) ); parseFilter( $filter ); $counts[] = "count(if(1".$filter['sql'].",1,NULL)) as EventCount$j"; @@ -96,8 +96,9 @@ for( $i = 0; $i < count($displayMonitors); $i += 1 ) { } $sql = "select ".join($counts,", ")." from Events as E where MonitorId = ?"; $counts = dbFetchOne( $sql, NULL, array($monitor['Id']) ); - if ( $counts ) $displayMonitors[$i] = array_merge( $monitor, $counts ); - for ( $j = 0; $j < count($eventCounts); $j++ ) { + if ( $counts ) + $displayMonitors[$i] = $monitor = array_merge( $monitor, $counts ); + for ( $j = 0; $j < count($eventCounts); $j += 1 ) { $eventCounts[$j]['total'] += $monitor['EventCount'.$j]; } $zoneCount += $monitor['ZoneCount'];