feat(api): explain dashboard chargeability by chapter

This commit is contained in:
2026-03-31 23:34:03 +02:00
parent a8fcc4dacb
commit 703406a76b
7 changed files with 403 additions and 31 deletions
@@ -225,6 +225,38 @@ describe("dashboard procedure support", () => {
},
},
]);
vi.mocked(getDashboardChargeabilityOverview).mockResolvedValue({
rows: [
{
id: "res_1",
eid: "E-001",
displayName: "Ada Lovelace",
chapter: "CGI",
chargeabilityTarget: 78,
actualChargeability: 64,
expectedChargeability: 72,
derivation: {
weeklyAvailabilityHours: 40,
baseWorkingDays: 23,
effectiveWorkingDayEquivalent: 21,
baseAvailableHours: 184,
effectiveAvailableHours: 168,
publicHolidayCount: 1,
publicHolidayWorkdayCount: 1,
publicHolidayHoursDeduction: 8,
absenceDayEquivalent: 1,
absenceHoursDeduction: 8,
actualBookedHours: 107.5,
expectedBookedHours: 121,
targetBookedHours: 131,
unassignedHours: 47,
},
},
],
top: [],
watchlist: [],
month: "2026-03",
});
try {
const result = await getDashboardDetail(createContext(), { section: "all" });
@@ -298,11 +330,40 @@ describe("dashboard procedure support", () => {
chargeabilityByChapter: [
{
chapter: "CGI",
headcount: 5,
headcount: 1,
avgTargetPct: 78,
avgActualPct: 64,
avgExpectedPct: 72,
gapToTargetPct: 14,
avgTarget: "78%",
avgActual: "64%",
avgExpected: "72%",
explainability: {
month: "2026-03",
resourceCount: 1,
derivedHeadcount: 1,
baseAvailableHours: 184,
effectiveAvailableHours: 168,
actualBookedHours: 107.5,
expectedBookedHours: 121,
targetBookedHours: 131,
publicHolidayHoursDeduction: 8,
absenceDayEquivalent: 1,
absenceHoursDeduction: 8,
unassignedHours: 47,
},
},
],
});
expect(getDashboardChargeabilityOverview).toHaveBeenCalledWith(
expect.anything(),
expect.objectContaining({
includeProposed: false,
topN: 10,
watchlistThreshold: 15,
}),
);
} finally {
vi.useRealTimers();
}