feat(political-office): enhance political office benefits and salary computation
All checks were successful
Deploy to production / deploy (push) Successful in 3m6s

- Added a new hierarchyLevel field to PoliticalOfficeType for better categorization of political roles.
- Updated computePoliticalDailySalaryPayout function to incorporate hierarchy level in salary calculations, allowing for more dynamic salary adjustments based on office rank.
- Modified SQL scripts to reflect changes in political office benefits, ensuring compatibility with the new salary structure.
- Enhanced localization files to support updated benefit descriptions and salary formats across multiple languages.
- Improved UI components to display the new salary calculations and benefits accurately in the PoliticsView.
This commit is contained in:
Torsten Schulz (local)
2026-04-02 16:49:18 +02:00
parent e063df5cbe
commit 07ab648143
17 changed files with 233 additions and 53 deletions

View File

@@ -21,8 +21,11 @@
-- psql "$DATABASE_URL" -v ON_ERROR_STOP=1 -f backend/sql/falukant_political_office_benefits.sql
--
-- JSON value daily_salary:
-- • dailyAmount: fester Tagesbetrag (überschreibt base/perRank)
-- • base + perRank: Auszahlung = base + (Amtsrang * perRank)
-- • dailyAmount: fester Tagesbetrag (überschreibt alles)
-- • rank: optional feste Stufe in JSON (überschreibt DB-Stufe)
-- • Standard: salaryStart × salaryGrowth^(Stufe1); Stufe = hierarchy_level (s. Migration political-office-hierarchy-level)
-- • Optional: salaryStart, salaryGrowth pro Amt; ENV POLITICAL_DAILY_SALARY_START / POLITICAL_DAILY_SALARY_GROWTH
-- • Legacy linear: salaryFormula = 'linear' und base, perRank
-- JSON value tax_exemption:
-- • regions: Text-Array (z. B. "city") oder "*" für alle Ebenen
-- =============================================================================
@@ -145,9 +148,9 @@ WHERE ot.name = 'chancellor'
WHERE x.office_type_id = ot.id AND x.benefit_type_id = bt.id
);
-- Tageslohn: base + Amtsrang * perRank (Rang in App: POLITICAL_OFFICE_RANKS)
-- Tageslohn: Betrag aus App-Formel (exponentiell nach hierarchy_level); value leer = Defaults
INSERT INTO falukant_predefine.political_office_benefit (office_type_id, benefit_type_id, value)
SELECT ot.id, bt.id, '{"base":4,"perRank":11}'::jsonb
SELECT ot.id, bt.id, '{}'::jsonb
FROM falukant_type.political_office_type ot
JOIN falukant_type.political_office_benefit_type bt ON bt.tr = 'daily_salary'
WHERE ot.name IN (