Link planned days to their wish, fix the age-4 cap, drop the planning goal

Three changes that together unblock treating a calendar period as one
editable object.

Migration 008 adds `planned_leave_day.wish_id` (nullable, ON DELETE SET NULL)
so a persisted day knows which `leave_wish` produced it, `is_pinned` to mark a
day the user hand-edited, and `leave_wish.target_days` so a period drawn on a
calendar need not be a whole number of weeks. Apply-time identity still keys on
day_type/is_dubbeldag only, so a wish_id-only difference is a metadata update
rather than a collision.

The age-4 savable ceiling was applying the per-child figure of 96 to each
parent's pool, modelling a two-parent family as able to save 192 days past the
child's fourth birthday. `resolve_age4_savable_cap` is now the single place
that decides 48 (couple with two parents) versus 96 (everyone else), and both
AnalyticsService and the allocator read it.

Migration 009 drops `workspace.planning_goal` and `leave_wish.goal_override`.
The allocator's tier-3 policy collapses to one rule; `salary_type` still
branches, since that reflects what a vacation day actually costs a parent
rather than a user preference.
This commit is contained in:
2026-09-15 20:28:06 +02:00
parent 7f516f2cab
commit cc3ced905e
59 changed files with 1427 additions and 740 deletions
+7 -1
View File
@@ -32,7 +32,13 @@ class LeaveRules(BaseModel):
max_dubbeldagar: int = 60 # both parents, same child-day
dubbeldagar_months_limit: int = 15 # only within the child's first 15 months
max_savable_days_at_age_4: int = 96 # age-4 ceiling
max_savable_days_at_age_4: int = 96 # age-4 ceiling — per CHILD (pooled across parents)
# Age-4 ceiling — per PARENT. The 96-day figure above is a per-child pool;
# when a child has two parents, each parent's own savable balance is
# capped at half of that (48), not 96 each (which would let a two-parent
# family save 192 combined). `app.utils.tip_predicates.resolve_age4_savable_cap`
# is the single place that decides which of the two applies.
max_savable_days_per_parent_at_age_4: int = 48
hard_expiry_age_years: int = 12
sgi_protected_first_months: int = 12