feat(political-office): enhance political office benefits and salary computation
All checks were successful
Deploy to production / deploy (push) Successful in 3m6s
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:
35
backend/sql/add_political_office_hierarchy_level.sql
Normal file
35
backend/sql/add_political_office_hierarchy_level.sql
Normal file
@@ -0,0 +1,35 @@
|
||||
-- Stufe pro politischem Amt (Tageshonorar: exponentielles Modell nach Stufe im Backend).
|
||||
-- Entspricht Migration 20260403120000-political-office-hierarchy-level.cjs
|
||||
|
||||
ALTER TABLE falukant_type.political_office_type
|
||||
ADD COLUMN IF NOT EXISTS hierarchy_level INTEGER NOT NULL DEFAULT 1;
|
||||
|
||||
UPDATE falukant_type.political_office_type AS pot
|
||||
SET hierarchy_level = sub.lvl
|
||||
FROM (VALUES
|
||||
('assessor', 1),
|
||||
('councillor', 1),
|
||||
('council', 2),
|
||||
('beadle', 2),
|
||||
('town-clerk', 2),
|
||||
('mayor', 3),
|
||||
('master-builder', 2),
|
||||
('village-major', 2),
|
||||
('judge', 3),
|
||||
('bailif', 3),
|
||||
('taxman', 2),
|
||||
('sheriff', 3),
|
||||
('consultant', 3),
|
||||
('treasurer', 4),
|
||||
('hangman', 2),
|
||||
('territorial-council', 3),
|
||||
('territorial-council-speaker', 4),
|
||||
('ruler-consultant', 4),
|
||||
('state-administrator', 4),
|
||||
('super-state-administrator', 5),
|
||||
('governor', 5),
|
||||
('ministry-helper', 4),
|
||||
('minister', 5),
|
||||
('chancellor', 6)
|
||||
) AS sub(name, lvl)
|
||||
WHERE pot.name = sub.name;
|
||||
@@ -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^(Stufe−1); 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 (
|
||||
|
||||
@@ -125,7 +125,7 @@ WHERE ot.name = 'chancellor'
|
||||
|
||||
-- ========== Schritt 7 ==========
|
||||
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 (
|
||||
|
||||
Reference in New Issue
Block a user