Skip to content

Commit

Permalink
fix(backend): count department hours
Browse files Browse the repository at this point in the history
  • Loading branch information
RamonaNF committed May 14, 2024
1 parent 72c5f19 commit 5807e99
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/infra/repositories/company.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ async function findAll(): Promise<CompanyEntity[]> {
SELECT c.*,
COUNT(DISTINCT p.id) as total_projects,
SUM(CASE WHEN p.is_chargeable THEN t.worked_hours ELSE 0 END) AS chargeable_hours,
SUM(CASE WHEN p.is_chargeable AND p.area='ACCOUNTING' THEN t.worked_hours ELSE 0 END) AS accounting_hours,
SUM(CASE WHEN p.is_chargeable AND p.area='LEGAL' THEN t.worked_hours ELSE 0 END) AS legal_hours
SUM(CASE WHEN p.is_chargeable AND p.area='Accounting' THEN t.worked_hours ELSE 0 END) AS accounting_hours,
SUM(CASE WHEN p.is_chargeable AND p.area='Legal' THEN t.worked_hours ELSE 0 END) AS legal_hours
FROM company c
LEFT JOIN project p ON c.id=p.id_company
LEFT JOIN task t ON p.id=t.id_project
Expand Down

0 comments on commit 5807e99

Please sign in to comment.