From 54d8e115dcec24e8ee7fc0f31d05b5ccddb9bde2 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Mon, 18 Mar 2024 17:10:39 +0100 Subject: [PATCH] HostgroupTableRow: Prevent filter doubles --- .../Icingadb/Widget/ItemTable/HostgroupTableRow.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/library/Icingadb/Widget/ItemTable/HostgroupTableRow.php b/library/Icingadb/Widget/ItemTable/HostgroupTableRow.php index cb3f06a9a..b4273e45c 100644 --- a/library/Icingadb/Widget/ItemTable/HostgroupTableRow.php +++ b/library/Icingadb/Widget/ItemTable/HostgroupTableRow.php @@ -32,7 +32,11 @@ protected function createStatistics(): array $hostStats = new HostStatistics($this->item); $hostStats->setBaseFilter(Filter::equal('hostgroup.name', $this->item->name)); - if (isset($this->table) && $this->table->hasBaseFilter()) { + if ( + isset($this->table) + && $this->table->hasBaseFilter() + && ! $hostStats->getBaseFilter()->sameAs($this->table->getBaseFilter()) + ) { $hostStats->setBaseFilter( Filter::all($hostStats->getBaseFilter(), $this->table->getBaseFilter()) ); @@ -41,7 +45,11 @@ protected function createStatistics(): array $serviceStats = new ServiceStatistics($this->item); $serviceStats->setBaseFilter(Filter::equal('hostgroup.name', $this->item->name)); - if (isset($this->table) && $this->table->hasBaseFilter()) { + if ( + isset($this->table) + && $this->table->hasBaseFilter() + && ! $serviceStats->getBaseFilter()->sameAs($this->table->getBaseFilter()) + ) { $serviceStats->setBaseFilter( Filter::all($serviceStats->getBaseFilter(), $this->table->getBaseFilter()) );