Delete date helpers nothing calls
A hand-rolled month-arithmetic module survived the move to dateutil with no caller left but its own tests, and two predicates alongside it were never wired up at all. An error import was also being deferred inside a function for a circular dependency that does not exist.
This commit is contained in:
@@ -13,7 +13,7 @@ from datetime import date, timedelta
|
||||
|
||||
from dateutil.relativedelta import relativedelta
|
||||
|
||||
from app.config import settings
|
||||
from app.config import LeaveRules, settings
|
||||
from app.entities.child import Child
|
||||
from app.entities.personal_data import PersonalData
|
||||
from app.entities.planned_leave import PlannedLeaveDay
|
||||
@@ -32,6 +32,19 @@ def weekly_intensity(planned_days: list[PlannedLeaveDay], period_weeks: float) -
|
||||
return len(fp_days) / period_weeks
|
||||
|
||||
|
||||
def default_tier_pool_share(rules: LeaveRules) -> tuple[int, int]:
|
||||
"""The per-parent (sjukpenning_left, lagsta_left) assumed when no FK
|
||||
snapshot exists yet.
|
||||
|
||||
`rules.sjukpenning_days`/`lagsta_niva_days` are the WHOLE CHILD's combined
|
||||
tier totals (390 + 90), split across both parents — halving them gives a
|
||||
single parent's default share. Shared by `AllocationInputLoader.load` and
|
||||
`PlanningService._tier_pool_left` so they can never derive it differently
|
||||
(see "Bug A": they once did, 390/90 in one place vs. 195/45 in the other).
|
||||
"""
|
||||
return rules.sjukpenning_days // 2, rules.lagsta_niva_days // 2
|
||||
|
||||
|
||||
def resolve_age4_savable_cap(planning_mode: str, parent_count: int) -> int:
|
||||
"""Single source of truth for which age-4 savable-days ceiling applies.
|
||||
|
||||
@@ -100,11 +113,6 @@ def age4_pooling_loss(
|
||||
return max(reachable_pooled - reachable_per_parent, 0)
|
||||
|
||||
|
||||
def is_child_under_age(birth_date: date, months: int) -> bool:
|
||||
"""True if the child's age in months is less than `months`."""
|
||||
return date.today() < birth_date + relativedelta(months=months)
|
||||
|
||||
|
||||
def is_child_over_age(birth_date: date, years: int) -> bool:
|
||||
"""True if the child has turned `years`."""
|
||||
return date.today() >= birth_date + relativedelta(years=years)
|
||||
|
||||
Reference in New Issue
Block a user