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

@@ -436,7 +436,7 @@
"voteAllError": "Sayop sa paghatag sa mga boto",
"applyError": "Dili mapadala ang aplikasyon.",
"benefits": {
"daily_salary": "Adlaw-adlaw nga suhol (usa ra kada adlaw): mga {amount}",
"daily_salary": "Adlaw-adlaw nga suhol (usa ra kada adlaw): {amount}",
"tax_exemption": "Way buhis: {regions}",
"tax_exemption_all": "Way buhis: tanang lebel sa rehiyon",
"reputation_periodic": "+{gain} reputasyon matag {days} ka adlaw (benepisyo sa opisina)",

View File

@@ -391,6 +391,8 @@
"reviewPriorityTitle": "Hinay-hinay nga gisagol ang balik-balik",
"reviewPriorityIntro": "Sa sinugdan, ang pokus anaa sa bag-ong mga pulong niining leksiyona. Samtang mopadayon ka, hinay-hinay nga masagol ang daan nga bokabularyo.",
"exerciseLockTitle": "Naka-lock pa ang chapter test",
"exerciseUnlockHintTrainerCore": "Ma-unlock ang chapter test kung natuman ang tulo ka kondisyon: labing menos {newTarget} ka pangutana bahin sa bag-ong sulod (tan-awa ang “Bag-ong sulod”), mga {attempts} ka pangutana sa trainer sa kinatibuk-an, ug dili ubos sa {rate}% nga success rate.",
"exerciseUnlockHintTrainerMixSuffix": "Ang daan nga bokabularyo hinay-hinay nga gisagol.",
"trainerStartWithReview": "Sugdi sa bag-ong bokabularyo niining leksiyona. Samtang nagpraktis ka, awtomatikong isagol sa trainer ang angay nga balik-balik.",
"startLesson": "Sugdi ang leksiyon",
"trainerProgressNewContent": "Bag-ong sulod: {current}/{target}",

View File

@@ -1357,7 +1357,7 @@
"voteAllError": "Fehler beim Abgeben der Stimmen",
"applyError": "Bewerbung konnte nicht eingereicht werden.",
"benefits": {
"daily_salary": "Tagesamtshonorar (einmal pro Tag): ca. {amount}",
"daily_salary": "Tagesamtshonorar (einmal pro Tag): {amount}",
"tax_exemption": "Steuerbefreiung: {regions}",
"tax_exemption_all": "Steuerbefreiung: alle Regionsebenen",
"reputation_periodic": "+{gain} Ansehen alle {days} Tage (Amtsbonus)",

View File

@@ -746,6 +746,8 @@
"reviewPriorityTitle": "Wiederholung läuft schrittweise mit",
"reviewPriorityIntro": "Zuerst liegt der Fokus auf den neuen Begriffen dieser Lektion. Mit deinem Fortschritt fließen ältere Vokabeln dann zunehmend mit ein.",
"exerciseLockTitle": "Kapitel-Prüfung noch gesperrt",
"exerciseUnlockHintTrainerCore": "Die Kapitel-Prüfung wird freigeschaltet, wenn alle drei Bedingungen erfüllt sind: mindestens {newTarget} Fragen zu den neuen Inhalten (Zeile „Neue Inhalte“), insgesamt etwa {attempts} Trainerfragen und mindestens {rate} % Erfolgsrate.",
"exerciseUnlockHintTrainerMixSuffix": "Ältere Vokabeln fließen dabei schrittweise mit ein.",
"trainerStartWithReview": "Starte mit den neuen Vokabeln dieser Lektion. Mit fortschreitendem Üben mischt der Trainer automatisch passende Wiederholungen ein.",
"startLesson": "Lektion starten",
"trainerProgressNewContent": "Neue Inhalte: {current}/{target}",

View File

@@ -576,7 +576,7 @@
"voteAllError": "Error while submitting the votes",
"applyError": "Application could not be submitted.",
"benefits": {
"daily_salary": "Daily office stipend (once per day): about {amount}",
"daily_salary": "Daily office stipend (once per day): {amount}",
"tax_exemption": "Tax exemption: {regions}",
"tax_exemption_all": "Tax exemption: all regional levels",
"reputation_periodic": "+{gain} reputation every {days} days (office bonus)",

View File

@@ -746,6 +746,8 @@
"reviewPriorityTitle": "Review is mixed in step by step",
"reviewPriorityIntro": "The focus starts on the new terms of this lesson. As you progress, older vocabulary is gradually mixed in.",
"exerciseLockTitle": "Chapter test still locked",
"exerciseUnlockHintTrainerCore": "The chapter test unlocks when all three conditions are met: at least {newTarget} questions on new content (see “New content”), about {attempts} trainer questions in total, and a success rate of at least {rate}%.",
"exerciseUnlockHintTrainerMixSuffix": "Older vocabulary is mixed in gradually.",
"trainerStartWithReview": "Start with the new vocabulary from this lesson. As you practice, the trainer will automatically mix in fitting review items.",
"startLesson": "Start lesson",
"trainerProgressNewContent": "New content: {current}/{target}",

View File

@@ -1265,7 +1265,7 @@
"elections": "Elecciones"
},
"benefits": {
"daily_salary": "Estipendio diario (una vez al día): unos {amount}",
"daily_salary": "Estipendio diario (una vez al día): {amount}",
"tax_exemption": "Exención fiscal: {regions}",
"tax_exemption_all": "Exención fiscal: todos los niveles regionales",
"reputation_periodic": "+{gain} reputación cada {days} días (bono de cargo)",

View File

@@ -744,6 +744,8 @@
"reviewPriorityTitle": "El repaso se mezcla paso a paso",
"reviewPriorityIntro": "Primero el foco está en los términos nuevos de esta lección. Con tu progreso se van mezclando cada vez más vocablos anteriores.",
"exerciseLockTitle": "La prueba del capítulo sigue bloqueada",
"exerciseUnlockHintTrainerCore": "La prueba del capítulo se desbloquea cuando se cumplen las tres condiciones: al menos {newTarget} preguntas sobre el contenido nuevo (línea «Contenido nuevo»), unas {attempts} preguntas del entrenador en total y una tasa de aciertos de al menos {rate}%.",
"exerciseUnlockHintTrainerMixSuffix": "El vocabulario anterior se mezcla poco a poco.",
"trainerStartWithReview": "Empieza con el vocabulario nuevo de esta lección. A medida que avances, el entrenador mezclará automáticamente repasos adecuados.",
"startLesson": "Empezar lección",
"trainerProgressNewContent": "Contenido nuevo: {current}/{target}",

View File

@@ -335,7 +335,9 @@ export default {
return this.$t('falukant.politics.benefits.tax_exemption', { regions: labels });
}
if (b.tr === 'daily_salary') {
return this.$t('falukant.politics.benefits.daily_salary', { amount: b.params?.amount ?? '—' });
return this.$t('falukant.politics.benefits.daily_salary', {
amount: this.formatPoliticsMoney(b.params?.amount)
});
}
if (b.tr === 'reputation_periodic') {
return this.$t('falukant.politics.benefits.reputation_periodic', {
@@ -586,6 +588,18 @@ export default {
});
},
/** Geldbetrag wie in Familie/Bank (exakter Wert, kein „ca.“). */
formatPoliticsMoney(value) {
const n = Number(value);
if (!Number.isFinite(n)) {
return '—';
}
return new Intl.NumberFormat(this.$i18n.locale, {
minimumFractionDigits: 2,
maximumFractionDigits: 2
}).format(n);
},
async loadOwnCharacterId() {
try {
const { data } = await apiClient.get('/api/falukant/info');

View File

@@ -874,6 +874,8 @@ import apiClient from '@/utils/axios.js';
const debugLog = () => {};
const LESSON_STATE_VERSION = 1;
const VOCAB_REPEAT_INTERVALS = [1, 2, 4];
/** Mindest-Erfolgsquote im Vokabeltrainer (gesamt), damit die Kapitel-Prüfung freigeschaltet wird. */
const EXERCISE_UNLOCK_MIN_SUCCESS_PERCENT = 70;
export default {
name: 'VocabLessonView',
@@ -991,6 +993,9 @@ export default {
const unlockTarget = this.trainerNewFocusTarget + Math.ceil((this.effectiveExercises?.length || 0) * 0.25);
return Math.max(6, Math.min(140, unlockTarget));
},
exerciseUnlockMinSuccessPercent() {
return EXERCISE_UNLOCK_MIN_SUCCESS_PERCENT;
},
currentReviewShare() {
if (!this.hasPreviousVocab) {
return 0;
@@ -1018,10 +1023,15 @@ export default {
if (this.trainableLessonVocab.length === 0 && this.prepItems.length > 0) {
return this.$t('socialnetwork.vocab.courses.exerciseUnlockHintAfterPrep');
}
const core = this.$t('socialnetwork.vocab.courses.exerciseUnlockHintTrainerCore', {
newTarget: this.trainerNewFocusTarget,
attempts: this.trainerExerciseUnlockAttempts,
rate: this.exerciseUnlockMinSuccessPercent
});
if (this.hasPreviousVocab) {
return `Lerne zuerst die neuen Inhalte der Lektion und arbeite dich durch ungefähr ${this.trainerExerciseUnlockAttempts} Trainerfragen. Ältere Vokabeln werden dabei nach und nach zugemischt.`;
return `${core} ${this.$t('socialnetwork.vocab.courses.exerciseUnlockHintTrainerMixSuffix')}`;
}
return `Arbeite zuerst durch ungefähr ${this.trainerExerciseUnlockAttempts} Trainerfragen aus dieser Lektion. Danach wird die Kapitel-Prüfung freigeschaltet.`;
return core;
},
/** Für Wiederholungslektionen: Übungen aus vorherigen Lektionen (Kapitelprüfung). Sonst: eigene Grammatik-Übungen. */
effectiveExercises() {
@@ -1697,7 +1707,11 @@ export default {
: 0;
const currentLessonReady = this.vocabTrainerCurrentAttempts >= this.trainerNewFocusTarget;
if (currentLessonReady && this.vocabTrainerTotalAttempts >= minimumAttempts && successRate >= 70) {
if (
currentLessonReady
&& this.vocabTrainerTotalAttempts >= minimumAttempts
&& successRate >= EXERCISE_UNLOCK_MIN_SUCCESS_PERCENT
) {
this.exercisePreparationCompleted = true;
}
},