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:
@@ -421,30 +421,30 @@ const politicalOfficeExtraBenefitSeeds = [
|
||||
];
|
||||
|
||||
const politicalOffices = [
|
||||
{ tr: "assessor", seatsPerRegion: 10, regionType: "city", termLength: 5 },
|
||||
{ tr: "councillor", seatsPerRegion: 7, regionType: "city", termLength: 7 },
|
||||
{ tr: "council", seatsPerRegion: 5, regionType: "city", termLength: 4 },
|
||||
{ tr: "beadle", seatsPerRegion: 1, regionType: "city", termLength: 6 },
|
||||
{ tr: "town-clerk", seatsPerRegion: 3, regionType: "city", termLength: 10 },
|
||||
{ tr: "mayor", seatsPerRegion: 1, regionType: "city", termLength: 3 },
|
||||
{ tr: "master-builder", seatsPerRegion: 10, regionType: "county", termLength: 10 },
|
||||
{ tr: "village-major", seatsPerRegion: 6, regionType: "county", termLength: 5 },
|
||||
{ tr: "judge", seatsPerRegion: 3, regionType: "county", termLength: 8 },
|
||||
{ tr: "bailif", seatsPerRegion: 1, regionType: "county", termLength: 4 },
|
||||
{ tr: "taxman", seatsPerRegion: 8, regionType: "shire", termLength: 5 },
|
||||
{ tr: "sheriff", seatsPerRegion: 5, regionType: "shire", termLength: 8 },
|
||||
{ tr: "consultant", seatsPerRegion: 3, regionType: "shire", termLength: 9 },
|
||||
{ tr: "treasurer", seatsPerRegion: 1, regionType: "shire", termLength: 7 },
|
||||
{ tr: "hangman", seatsPerRegion: 9, regionType: "markgravate", termLength: 5 },
|
||||
{ tr: "territorial-council", seatsPerRegion: 6, regionType: "markgravate", termLength: 6 },
|
||||
{ tr: "territorial-council-speaker", seatsPerRegion: 4, regionType: "markgravate", termLength: 8 },
|
||||
{ tr: "ruler-consultant", seatsPerRegion: 1, regionType: "markgravate", termLength: 3 },
|
||||
{ tr: "state-administrator", seatsPerRegion: 7, regionType: "duchy", termLength: 3 },
|
||||
{ tr: "super-state-administrator", seatsPerRegion: 5, regionType: "duchy", termLength: 6 },
|
||||
{ tr: "governor", seatsPerRegion: 1, regionType: "duchy", termLength: 5 },
|
||||
{ tr: "ministry-helper", seatsPerRegion: 12, regionType: "country", termLength: 4 },
|
||||
{ tr: "minister", seatsPerRegion: 3, regionType: "country", termLength: 4 },
|
||||
{ tr: "chancellor", seatsPerRegion: 1, regionType: "country", termLength: 4 }
|
||||
{ tr: "assessor", seatsPerRegion: 10, regionType: "city", termLength: 5, hierarchyLevel: 1 },
|
||||
{ tr: "councillor", seatsPerRegion: 7, regionType: "city", termLength: 7, hierarchyLevel: 1 },
|
||||
{ tr: "council", seatsPerRegion: 5, regionType: "city", termLength: 4, hierarchyLevel: 2 },
|
||||
{ tr: "beadle", seatsPerRegion: 1, regionType: "city", termLength: 6, hierarchyLevel: 2 },
|
||||
{ tr: "town-clerk", seatsPerRegion: 3, regionType: "city", termLength: 10, hierarchyLevel: 2 },
|
||||
{ tr: "mayor", seatsPerRegion: 1, regionType: "city", termLength: 3, hierarchyLevel: 3 },
|
||||
{ tr: "master-builder", seatsPerRegion: 10, regionType: "county", termLength: 10, hierarchyLevel: 2 },
|
||||
{ tr: "village-major", seatsPerRegion: 6, regionType: "county", termLength: 5, hierarchyLevel: 2 },
|
||||
{ tr: "judge", seatsPerRegion: 3, regionType: "county", termLength: 8, hierarchyLevel: 3 },
|
||||
{ tr: "bailif", seatsPerRegion: 1, regionType: "county", termLength: 4, hierarchyLevel: 3 },
|
||||
{ tr: "taxman", seatsPerRegion: 8, regionType: "shire", termLength: 5, hierarchyLevel: 2 },
|
||||
{ tr: "sheriff", seatsPerRegion: 5, regionType: "shire", termLength: 8, hierarchyLevel: 3 },
|
||||
{ tr: "consultant", seatsPerRegion: 3, regionType: "shire", termLength: 9, hierarchyLevel: 3 },
|
||||
{ tr: "treasurer", seatsPerRegion: 1, regionType: "shire", termLength: 7, hierarchyLevel: 4 },
|
||||
{ tr: "hangman", seatsPerRegion: 9, regionType: "markgravate", termLength: 5, hierarchyLevel: 2 },
|
||||
{ tr: "territorial-council", seatsPerRegion: 6, regionType: "markgravate", termLength: 6, hierarchyLevel: 3 },
|
||||
{ tr: "territorial-council-speaker", seatsPerRegion: 4, regionType: "markgravate", termLength: 8, hierarchyLevel: 4 },
|
||||
{ tr: "ruler-consultant", seatsPerRegion: 1, regionType: "markgravate", termLength: 3, hierarchyLevel: 4 },
|
||||
{ tr: "state-administrator", seatsPerRegion: 7, regionType: "duchy", termLength: 3, hierarchyLevel: 4 },
|
||||
{ tr: "super-state-administrator", seatsPerRegion: 5, regionType: "duchy", termLength: 6, hierarchyLevel: 5 },
|
||||
{ tr: "governor", seatsPerRegion: 1, regionType: "duchy", termLength: 5, hierarchyLevel: 5 },
|
||||
{ tr: "ministry-helper", seatsPerRegion: 12, regionType: "country", termLength: 4, hierarchyLevel: 4 },
|
||||
{ tr: "minister", seatsPerRegion: 3, regionType: "country", termLength: 4, hierarchyLevel: 5 },
|
||||
{ tr: "chancellor", seatsPerRegion: 1, regionType: "country", termLength: 4, hierarchyLevel: 6 }
|
||||
];
|
||||
|
||||
const politicalOfficePrerequisites = [
|
||||
@@ -1063,14 +1063,22 @@ export const initializePoliticalOfficeBenefitTypes = async () => {
|
||||
|
||||
export const initializePoliticalOfficeTypes = async () => {
|
||||
for (const po of politicalOffices) {
|
||||
await PoliticalOfficeType.findOrCreate({
|
||||
const level = Number(po.hierarchyLevel) >= 1 ? Number(po.hierarchyLevel) : 1;
|
||||
const [row, created] = await PoliticalOfficeType.findOrCreate({
|
||||
where: { name: po.tr },
|
||||
defaults: {
|
||||
seatsPerRegion: po.seatsPerRegion,
|
||||
regionType: po.regionType,
|
||||
termLength: po.termLength
|
||||
termLength: po.termLength,
|
||||
hierarchyLevel: level
|
||||
}
|
||||
});
|
||||
if (!created) {
|
||||
await PoliticalOfficeType.update(
|
||||
{ hierarchyLevel: level },
|
||||
{ where: { id: row.id } }
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1141,7 +1149,7 @@ export const initializePoliticalOfficeBenefits = async () => {
|
||||
defaults: {
|
||||
officeTypeId: office.id,
|
||||
benefitTypeId: dailyType.id,
|
||||
value: { base: 4, perRank: 11 }
|
||||
value: {}
|
||||
}
|
||||
});
|
||||
if (wasCreated) dailyCreated += 1;
|
||||
|
||||
Reference in New Issue
Block a user