Fix billable mapping (0=billable, 1=non-billable, 2=unproductive)
Some checks failed
Frontend / Frontend verification (push) Has been cancelled
Lint PHP / Linting (8.2) (push) Has been cancelled
Check .lock files / Verify lock file integrity (push) Has been cancelled
Release Drafter / Verify repository (push) Has been cancelled
Release Drafter / Draft next release (push) Has been cancelled
Tests / Integration (8.2) (push) Has been cancelled
Tests / Integration (8.3) (push) Has been cancelled
Tests / Integration (8.4) (push) Has been cancelled
Tests / Integration (8.5) (push) Has been cancelled
Actions Security Analysis / Scan workflows (push) Has been cancelled

- Swapped billable/non-billable SQL values to match migrated data
- All 3 pivot tables always render (empty ones show 'No data')
- Added grand total row to pivot tables
- Initialize unprodRows/userColumnsUP to prevent undefined var error
This commit is contained in:
root
2026-06-18 23:08:43 +00:00
parent baab938326
commit 3cd198c12c
2 changed files with 20 additions and 6 deletions

View File

@@ -35,13 +35,15 @@ final class TeamSummaryController extends AbstractController
$userColumns = [];
$nonbillRows = [];
$userColumnsNB = [];
$unprodRows = [];
$userColumnsUP = [];
if ($selectedTeamId > 0) {
$team = $this->teamRepository->find($selectedTeamId);
if ($team) {
$rows = $this->getUserTimeAnalysis($selectedTeamId, $from, $to);
[$projectRows, $userColumns] = $this->getProjectPivot($selectedTeamId, $from, $to, '= 1');
[$nonbillRows, $userColumnsNB] = $this->getProjectPivot($selectedTeamId, $from, $to, '= 0');
[$projectRows, $userColumns] = $this->getProjectPivot($selectedTeamId, $from, $to, '= 0');
[$nonbillRows, $userColumnsNB] = $this->getProjectPivot($selectedTeamId, $from, $to, '= 1');
[$unprodRows, $userColumnsUP] = $this->getProjectPivot($selectedTeamId, $from, $to, '= 2');
}
}
@@ -68,8 +70,8 @@ final class TeamSummaryController extends AbstractController
$sql = "SELECT
u.username,
u.alias,
COALESCE(SUM(CASE WHEN p.billable = 1 THEN ts.duration END), 0) / 3600 AS billable_hours,
COALESCE(SUM(CASE WHEN p.billable = 0 THEN ts.duration END), 0) / 3600 AS nonbillable_hours,
COALESCE(SUM(CASE WHEN p.billable = 0 THEN ts.duration END), 0) / 3600 AS billable_hours,
COALESCE(SUM(CASE WHEN p.billable = 1 THEN ts.duration END), 0) / 3600 AS nonbillable_hours,
COALESCE(SUM(CASE WHEN p.billable IS NULL OR p.billable NOT IN (0,1) THEN ts.duration END), 0) / 3600 AS unproductive_hours,
COALESCE(SUM(ts.duration), 0) / 3600 AS total_hours
FROM kimai2_users u