Give the analytics overview a per-parent, per-year balance series
Each parent projection now carries one entry per calendar year from birth to the fourth birthday: vacation earned, carried in, planned, left, carried out and expiring under Semesterlagen's 20-day floor and 5-year carry-over, plus parental-leave days used and left at year end with the age-4 clamp applied in the birthday year. The overview sums them into per-year totals. Frontend types, mapper and fixtures follow. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XBRLomdLK9jF7wU7a8AA6H
This commit is contained in:
Vendored
+61
-1
@@ -1,6 +1,64 @@
|
||||
/** Shared test fixtures — Dashboard analytics (`GET /api/analytics/overview`). */
|
||||
|
||||
import type { Age4Projection, WorkspaceOverview } from '@/types'
|
||||
import type {
|
||||
Age4Projection,
|
||||
ParentalLeaveYearBalance,
|
||||
ParentYearBalance,
|
||||
VacationYearBalance,
|
||||
WorkspaceOverview,
|
||||
YearTotals,
|
||||
} from '@/types'
|
||||
|
||||
export function makeVacationYearBalance(
|
||||
overrides: Partial<VacationYearBalance> = {},
|
||||
): VacationYearBalance {
|
||||
return {
|
||||
year: 2025,
|
||||
earned: 25,
|
||||
isAssumed: true,
|
||||
carriedIn: 0,
|
||||
plannedUse: 0,
|
||||
left: 25,
|
||||
carriedOut: 5,
|
||||
expiring: 0,
|
||||
...overrides,
|
||||
}
|
||||
}
|
||||
|
||||
export function makeParentalLeaveYearBalance(
|
||||
overrides: Partial<ParentalLeaveYearBalance> = {},
|
||||
): ParentalLeaveYearBalance {
|
||||
return {
|
||||
year: 2025,
|
||||
sjukpenningUsed: 0,
|
||||
lagstaUsed: 0,
|
||||
sjukpenningLeft: 390,
|
||||
lagstaLeft: 90,
|
||||
...overrides,
|
||||
}
|
||||
}
|
||||
|
||||
export function makeParentYearBalance(
|
||||
overrides: Partial<ParentYearBalance> = {},
|
||||
): ParentYearBalance {
|
||||
return {
|
||||
personalDataUuid: 'pd-a',
|
||||
childId: 'child-1',
|
||||
year: 2025,
|
||||
vacation: makeVacationYearBalance(),
|
||||
parentalLeave: makeParentalLeaveYearBalance(),
|
||||
...overrides,
|
||||
}
|
||||
}
|
||||
|
||||
export function makeYearTotals(overrides: Partial<YearTotals> = {}): YearTotals {
|
||||
return {
|
||||
year: 2025,
|
||||
plLeft: 480,
|
||||
vacationLeft: 25,
|
||||
...overrides,
|
||||
}
|
||||
}
|
||||
|
||||
export function makeAge4Projection(overrides: Partial<Age4Projection> = {}): Age4Projection {
|
||||
return {
|
||||
@@ -15,6 +73,7 @@ export function makeAge4Projection(overrides: Partial<Age4Projection> = {}): Age
|
||||
savableAfterB4: 96,
|
||||
expiringAtB4: 60,
|
||||
savableCapAtB4: 96,
|
||||
yearBalances: [],
|
||||
...overrides,
|
||||
}
|
||||
}
|
||||
@@ -27,6 +86,7 @@ export function makeWorkspaceOverview(overrides: Partial<WorkspaceOverview> = {}
|
||||
combinedDaysUsed: 30,
|
||||
combinedDaysLeft: 270,
|
||||
combinedExpiringAtB4: 100,
|
||||
yearTotals: [],
|
||||
...overrides,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user