From 9caae181ba034e98d443b448db328617e5627bf7 Mon Sep 17 00:00:00 2001 From: Gaurav Gusain Date: Thu, 3 Oct 2024 10:06:45 +0530 Subject: [PATCH] minor fix --- app/Services/EmployeeService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Services/EmployeeService.php b/app/Services/EmployeeService.php index 6679e3f0e4..cb8c6de57b 100644 --- a/app/Services/EmployeeService.php +++ b/app/Services/EmployeeService.php @@ -12,7 +12,7 @@ public function index($filters = []) ->leftJoin('project_team_members', 'employees.user_id', '=', 'project_team_members.team_member_id') ->leftJoin('projects', 'project_team_members.project_id', '=', 'projects.id') ->leftJoin('clients', 'projects.client_id', '=', 'clients.id') - ->selectRaw('employees.*, team_member_id, count(case when projects.status = "active" and project_team_members.ended_on is null then 1 else null end) as active_project_count, count(distinct case when clients.status = "active" and project_team_members.ended_on is null then clients.id else null end) as active_clients_count') + ->selectRaw('employees.*, team_member_id, count(case when projects.status = "active" and project_team_members.ended_on is null then 1 else null end) as active_project_count, count(distinct case when clients.status = "active" and projects.status = "active" and project_team_members.ended_on is null then clients.id else null end) as active_clients_count') ->groupBy('employees.user_id') ->orderby('active_project_count', 'desc') ->get();