From 4cc035cbd5cb111f7a6245c08abb70fbb4068949 Mon Sep 17 00:00:00 2001 From: aydreeihn <adriane@enhancesoft.com> Date: Thu, 25 Oct 2018 11:37:24 -0500 Subject: [PATCH] Dashboard Statistics Issue This commit fixes an issue where we were not able to see all of the departments, topics, and agents that should have been included in the report. The logic for the GROUP BY in the queries was changed, so we just manually added them back in. --- include/class.report.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/include/class.report.php b/include/class.report.php index dbff0ba38..36c06fea4 100644 --- a/include/class.report.php +++ b/include/class.report.php @@ -215,7 +215,8 @@ class OverviewReport { $pk = 'dept__id'; $stats = $stats ->filter(array('dept_id__in' => $thisstaff->getDepts())) - ->values('dept__id', 'dept__name', 'dept__flags'); + ->values('dept__id', 'dept__name', 'dept__flags') + ->distinct('dept__id'); $times = $times ->filter(array('dept_id__in' => $thisstaff->getDepts())) ->values('dept__id'); @@ -227,7 +228,8 @@ class OverviewReport { $topics = Topic::getHelpTopics(false, Topic::DISPLAY_DISABLED); $stats = $stats ->values('topic_id', 'topic__topic', 'topic__flags') - ->filter(array('dept_id__in' => $thisstaff->getDepts(), 'topic_id__gt' => 0, 'topic_id__in' => array_keys($topics))); + ->filter(array('dept_id__in' => $thisstaff->getDepts(), 'topic_id__gt' => 0, 'topic_id__in' => array_keys($topics))) + ->distinct('topic_id'); $times = $times ->values('topic_id') ->filter(array('topic_id__gt' => 0)); @@ -240,7 +242,8 @@ class OverviewReport { $staff = Staff::getStaffMembers(); $stats = $stats ->values('staff_id', 'staff__firstname', 'staff__lastname') - ->filter(array('staff_id__in' => array_keys($staff))); + ->filter(array('staff_id__in' => array_keys($staff))) + ->distinct('staff_id'); $times = $times->values('staff_id'); $depts = $thisstaff->getManagedDepartments(); if ($thisstaff->hasPerm(ReportModel::PERM_AGENTS)) -- GitLab