Skip to content

Commit

Permalink
Merge pull request #3724 from ColoredCow/fix/active-clients-count
Browse files Browse the repository at this point in the history
Fix active clients count
  • Loading branch information
GauravGusain98 authored Oct 3, 2024
2 parents d650548 + 9caae18 commit 5b18c81
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/Services/EmployeeService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 5b18c81

Please sign in to comment.