Commit Graph

3 Commits

Author SHA1 Message Date
ChakibMoMi
d57bdd02e1 Polish retirement feature: Custom calculator, grouped select, auto-detect, UK progress
- Extract Custom pension calculator class (was mapped to Base, which raises
  NotImplementedError — now explicit and safe)
- Remove if/custom short-circuit from estimated_monthly_pension — all systems
  go through pension_calculator uniformly
- Add PENSION_SYSTEM_GROUPS constant for grouped UI select and
  COUNTRY_TO_PENSION_SYSTEM + suggest_pension_system(country) for auto-detection
- Setup action pre-selects pension system and country from family profile
- Form dropdown now uses grouped_options_for_select grouped by region
- Show page displays UK State Pension qualifying-years progress bar for uk_sp
- Add pension_system_groups i18n keys in EN/DE/ES/FR
- Add UK progress i18n keys (uk_progress_title, uk_qualifying_years,
  uk_years_remaining) in all four locales
- Add 5 calculator unit tests (DE, US, UK, FR, ES) and update schema.rb
  to reflect GeneralizePensionSystems migration (pension_params JSONB,
  data JSONB, current_points nullable, old DE-specific columns removed)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-24 03:41:18 +02:00
ChakibMoMi
4f3230c904 Generalize pension system: multi-country strategy pattern
- Add JSONB pension_params column to retirement_configs
- Add data JSONB column to pension_entries
- Create pension calculator strategy classes (Base, DeGrv, UsSocialSecurity, UkStatePension, FrRegimeGeneral, EsSocialSecurity)
- Update RetirementConfig model to delegate to calculators
- Make PensionEntry.current_points optional for non-points systems
- Update controller strong params (pension_params: {})
- Add Stimulus pension_system_controller for dynamic form fields
- Update views with per-country field groups and conditional points columns
- Expand i18n (EN, DE) and add ES, FR locale files
- Update fixtures and tests for new schema

Addresses review feedback from jjmata on PR #1057
2026-04-09 00:37:11 +02:00
Chakib
cc12c4465d Add retirement / FIRE planning feature
Introduces retirement and FIRE (Financial Independence, Retire Early)
planning as a new top-level feature in the sidebar navigation.

Key features:
- RetirementConfig model: stores retirement planning parameters per family
  (birth year, retirement age, target income, pension system, etc.)
- PensionEntry model: tracks pension statements (Renteninformation) over time
  with pension points, current/projected monthly pension
- German GRV pension calculations:
  - Estimated monthly pension from Entgeltpunkte x Rentenwert
  - After-tax pension estimation
  - Monthly pension gap analysis
- FIRE calculations:
  - FIRE number (capital needed via 4% rule, inflation-adjusted)
  - FIRE progress percentage from current portfolio value
  - Estimated FIRE date (iterative monthly projection)
  - Required monthly savings to close pension gap
- Dashboard view with overview cards, FIRE progress bar, assumptions panel,
  and pension history table with add/delete entries
- Setup and edit views for configuring retirement parameters
- Full i18n support (English + German)
- Minitest coverage for models and controller

Database: 2 new tables (retirement_configs, pension_entries) with UUID PKs
Routes: singular resource with setup, add/destroy pension entry actions

This is an initial implementation focused on the German GRV pension system.
The architecture supports extending to other pension systems (custom/other).
Open to suggestions and improvements from the community - contributions for
additional pension systems, visualization charts, or calculation refinements
are very welcome.
2026-02-23 18:29:45 +01:00