Let vacation years go back to the child's birth year

Settings only offered vacation-day rows from the current year forward,
while analytics ran its balance series from the child's birth year. Every
year in the gap had no vacation_days row, so the series assumed a full
statutory 25 earned with no use and banked earned - floor of it forward —
phantom saved days the user had no row to correct.

Settings now offers editable rows back to the birth year, and a past year
with no row assumes only the floor was earned, so it banks nothing. A past
year the user did enter is untouched by that rule.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-22 20:49:56 +02:00
parent 06592df87c
commit 1a02bdcdbf
12 changed files with 248 additions and 33 deletions
+11 -1
View File
@@ -785,8 +785,18 @@ class TipsService:
known_years = {v.year for v in rows} | set(use_by_year.keys()) | {today.year}
start_year = min(min(known_years), today.year - (carry_years - 1))
years = list(range(start_year, today.year + 1))
# `years` reaches back to `today.year - (carry_years - 1)` (or an
# earlier known year) so the FIFO bank simulation can correctly
# age out old entries by `today.year` — those earlier years are
# real past years, not a forecast, so they get the same
# past-year `earned = floor` assumption as Settings/Analytics
# for a year with no row (`current_year=today.year`), rather
# than silently assuming the full statutory default the way a
# future year would. Keeps this tip's forfeiture warning from
# disagreeing with the dashboard's own numbers for the same
# unconfirmed past year.
series = AnalyticsService._vacation_year_series(
years, vacation_by_year, use_by_year, pd.min_vacation_days_per_year
years, vacation_by_year, use_by_year, pd.min_vacation_days_per_year, today.year
)
vacation_year_balance_by_parent[pd.uuid] = series[-1]