Track preschool planning days, partner invites and real vacation forfeiture
Three strands of work that grew together across the same settings screen and
API client, so they land as one change.
Per-year preschool planning days ("studiedagar"): new table, repository
(SQLite + Postgres), service, router and migration 007, plus the hooks and
Settings UI to plan and record them per child and year. Allocation now
reserves the recorded figure for a year where one exists and only falls back
to the child-level estimate otherwise, marking that fallback as assumed.
Partner invitations: workspaces issue and list invitations, registration
accepts an invite token to join the inviter's workspace instead of creating a
personal one, and a /join/:token page plus the settings invite panel drive it.
Vacation forfeiture: tips and the dashboard now distinguish days a parent
genuinely loses from days that merely age, so the warning stops firing on
balances that were never at risk.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -211,10 +211,27 @@ def has_vacation_near_expiry(
|
||||
Swedish law: vacation days above 20 may be saved for up to 5 years.
|
||||
This predicate flags when saved days exist — the tips service adds richer
|
||||
expiry logic when it has the full vacation history per year.
|
||||
|
||||
Kept as-is (still called by `allocation_service`'s per-budget check) —
|
||||
`has_genuine_vacation_forfeiture` below is the real replacement used by
|
||||
`tips_service._rule_use_vacation_before_expiry`, which has the actual
|
||||
computed per-year breakdown instead of this coarse heuristic.
|
||||
"""
|
||||
return vacation_saved_in > 0 and vacation_total > threshold_remaining_days
|
||||
|
||||
|
||||
def has_genuine_vacation_forfeiture(expiring_age: int, expiring_over_cap: int) -> bool:
|
||||
"""True if a parent's vacation balance for a given year actually lost days.
|
||||
|
||||
Takes `VacationYearBalance.expiring_age`/`.expiring_over_cap` (see
|
||||
`AnalyticsService._vacation_year_series`) — the real, already-computed
|
||||
per-year forfeiture breakdown — rather than guessing from a raw total
|
||||
like `has_vacation_near_expiry` does. Fires on genuine loss from either
|
||||
cause (age-out or over-cap), never on days that are merely saved.
|
||||
"""
|
||||
return (expiring_age + expiring_over_cap) > 0
|
||||
|
||||
|
||||
def hash_tip_data(data: dict[str, object]) -> str:
|
||||
"""Stable fingerprint of a tip's `data` bag.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user