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:
@@ -124,8 +124,7 @@ def _build_input() -> tuple[AllocationInput, dict]:
|
||||
alloc_input = AllocationInput(
|
||||
today=TODAY,
|
||||
horizon_end=horizon_end,
|
||||
planning_mode="couple",
|
||||
age4_savable_cap=resolve_age4_savable_cap("couple", parent_count=2),
|
||||
age4_savable_cap=resolve_age4_savable_cap(parent_count=2),
|
||||
children=[child],
|
||||
parents=[parent_1, parent_2],
|
||||
pools=pools,
|
||||
|
||||
@@ -214,7 +214,6 @@ async def _seed(conn: aiosqlite.Connection, *, reset: bool) -> None:
|
||||
email=DEMO_EMAIL, password=DEMO_PASSWORD, display_name=DEMO_NAME
|
||||
)
|
||||
workspace_id = alex.workspace_id
|
||||
await services.workspace.update_workspace(workspace_id, planning_mode="couple")
|
||||
|
||||
# -- 2. Partner (no login — shared/partner planning needs a second parent
|
||||
# on the workspace, but nothing requires them to have registered) -------
|
||||
@@ -261,15 +260,10 @@ async def _seed(conn: aiosqlite.Connection, *, reset: bool) -> None:
|
||||
workspace_id=workspace_id,
|
||||
child_id=child.id,
|
||||
total_days=240,
|
||||
days_used=240,
|
||||
reserved_days_total=90,
|
||||
sjukpenning_left=0,
|
||||
lagsta_niva_left=0,
|
||||
reserved_days_left=0,
|
||||
transferable_days_left=0,
|
||||
dubbeldagar_left=55,
|
||||
sjukpenning_total=195,
|
||||
sjukpenning_used=195,
|
||||
lagsta_niva_total=45,
|
||||
lagsta_niva_used=45,
|
||||
)
|
||||
|
||||
# -- 6. Day overrides -----------------------------------------------
|
||||
@@ -398,7 +392,7 @@ def _print_summary(
|
||||
print(f" Password: {DEMO_PASSWORD}")
|
||||
print()
|
||||
print("Created:")
|
||||
print(f" Workspace id: {workspace_id} (planning_mode=couple)")
|
||||
print(f" Workspace id: {workspace_id} (couple: 2 parents)")
|
||||
print(f" Parent 1: {DEMO_NAME} ({alex.uuid}) — has a login, near-drained FP pool")
|
||||
print(f" Parent 2: {PARTNER_NAME} ({sam.uuid}) — no login, large surplus pool")
|
||||
print(f" Child: {CHILD_NAME} ({child_id}), born {birth_date.isoformat()}")
|
||||
|
||||
Reference in New Issue
Block a user