Skip to content

Commit

Permalink
ServicedowntimeQuery: PostgreSQL grouping...
Browse files Browse the repository at this point in the history
refs #9009
  • Loading branch information
Johannes Meyer committed Jun 18, 2015
1 parent 72de85a commit 068c0b6
Showing 1 changed file with 29 additions and 2 deletions.
Expand Up @@ -99,7 +99,6 @@ protected function joinHostgroups()
'hgo.object_id = hg.hostgroup_object_id AND hgo.is_active = 1 AND hgo.objecttype_id = 3',
array()
);
$this->group(array('sd.scheduleddowntime_id', 'so.name2', 'so.name1'));
}

/**
Expand Down Expand Up @@ -146,7 +145,6 @@ protected function joinServicegroups()
'sgo.object_id = sg.servicegroup_object_id AND sgo.is_active = 1 AND sgo.objecttype_id = 4',
array()
);
$this->group(array('sd.scheduleddowntime_id', 'so.name2', 'so.name1'));
}

/**
Expand All @@ -172,4 +170,33 @@ protected function joinServicestatus()
array()
);
}

/**
* {@inheritdoc}
*/
public function getGroup()
{
$group = array();
if ($this->hasJoinedVirtualTable('hostgroups') || $this->hasJoinedVirtualTable('servicegroups')) {
$group = array('sd.scheduleddowntime_id', 'so.object_id');

if ($this->hasJoinedVirtualTable('hosts')) {
$group[] = 'h.host_id';
}

if ($this->hasJoinedVirtualTable('hoststatus')) {
$group[] = 'hs.hoststatus_id';
}

if ($this->hasJoinedVirtualTable('services')) {
$group[] = 's.service_id';
}

if ($this->hasJoinedVirtualTable('servicestatus')) {
$group[] = 'ss.servicestatus_id';
}
}

return $group;
}
}

0 comments on commit 068c0b6

Please sign in to comment.