Rework balances around per-parent days left and deduce the partner from FK

Manual entry now takes one parent's sjukpenningnivå, lägstanivå and
dubbeldagar left (plus optional reserved days) and derives the rest in
build_snapshot, shared with the scraper. The scraper also reads the
family panel and exposes a partner deduction; with two parents it is
saved as a 'deduced' snapshot (migration 002). Parent count is the single
source of entitlement: one member gets 480 days and 96 savable at age 4,
two get 240 and 48 each. Workspaces are capped at two parents.

Also lands the in-flight squash of migrations 002–011 into the initial
schema and the removal of planning_mode.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
2026-09-19 12:27:29 +02:00
parent 375bc64f2f
commit e4719cb9ae
71 changed files with 5705 additions and 1859 deletions
+12 -1
View File
@@ -83,10 +83,21 @@ async def sync_plan(
user has pinned, and reports exactly what changed (`changes`) so the UI
can show e.g. "Sommar 2028 flyttades 2 dagar — Ångra" instead of
silently rewriting the calendar.
Doubles as its own eviction preview: when the re-derived plan would
silently delete another wish's days (a shared FP/vacation pool ran out
for that wish's parent), this call writes NOTHING and returns
`eviction_preview` describing what ran out and which days would go —
unless `eviction_choice` names one of the two caller-authorized
eviction strategies, in which case exactly that category is freed and
the edit is applied. No separate round trip for the common (fits-
within-budget) case; see `PlanningService.sync_plan`'s docstring.
"""
scope.check_workspace(payload.workspace_id)
try:
result = await service.sync_plan(payload.workspace_id)
result = await service.sync_plan(
payload.workspace_id, eviction_choice=payload.eviction_choice
)
except NotFoundError as exc:
raise HTTPException(status.HTTP_404_NOT_FOUND, str(exc)) from exc
except ValidationError as exc: