fix(falukant): improve product pricing logic and update localization for office notifications
All checks were successful
Deploy to production / deploy (push) Successful in 2m44s

- Refactored the product pricing logic in `falukantService.js` to ensure accurate regional pricing calculations based on client values and server data.
- Added new notification translations for "office filled" in multiple languages (Cebuano, German, English, Spanish, French) to enhance user experience and clarity in notifications.
This commit is contained in:
Torsten Schulz (local)
2026-04-09 09:21:47 +02:00
parent 1118a691b9
commit 641a2134cb
6 changed files with 12 additions and 5 deletions

View File

@@ -7036,13 +7036,15 @@ ORDER BY r.id`,
? Number(clientPriceRaw)
: NaN;
let currentRegionalPrice;
if (!Number.isNaN(clientPriceNum)) {
// Referenzpreis wie in der Ertrags-Tabelle (z. B. MAX-Worth über Filialen)
currentRegionalPrice = clientPriceNum;
} else if (currentRegionId) {
// Wie getProductPricesInCities: bei bekannter Standort-Region immer
// serverseitigen Verkaufspreis dieser Region als Referenz — nicht den
// Client-Wert (Ertrags-Tabelle kann MAX-Worth über Filialen nutzen).
if (currentRegionId) {
const wp = worthByProductRegion.get(`${product.id}-${currentRegionId}`) ?? 50;
currentRegionalPrice = calcRegionalSellPriceSync(product, knowledgeFactor, wp)
?? Number(product.sellCost) ?? 0;
?? (!Number.isNaN(clientPriceNum) ? clientPriceNum : Number(product.sellCost) ?? 0);
} else if (!Number.isNaN(clientPriceNum)) {
currentRegionalPrice = clientPriceNum;
} else {
currentRegionalPrice = Number(product.sellCost) || 0;
}

View File

@@ -33,6 +33,7 @@
},
"notifications": {
"notify_election_created": "Giskedyul ang usa ka bag-ong eleksiyon.",
"notify_office_filled": "Na puno ang usa ka politikal nga opisina.",
"director_death": "Namatay si {characterName} sa edad nga {ageYears}. Isip amo, kinahanglan kang magtudlo og bag-ong direktor.{regionLabel}{spouses}{children}{lovers}",
"relationship_death": "Namatay si {characterName} sa edad nga {ageYears}.{regionLabel}{spouses}{children}{lovers}",
"child_death": "Namatay ang imong anak nga si {characterName} sa edad nga {ageYears}.{regionLabel}",

View File

@@ -47,6 +47,7 @@
},
"notifications": {
"notify_election_created": "Es wurde eine neue Wahl ausgeschrieben.",
"notify_office_filled": "Ein politisches Amt wurde neu besetzt.",
"director_death": "{characterName} ist im Alter von {ageYears} Jahren verstorben. Als Arbeitgeber musst du die Direktion neu besetzen.{regionLabel}{spouses}{children}{lovers}",
"relationship_death": "{characterName} ist im Alter von {ageYears} Jahren verstorben.{regionLabel}{spouses}{children}{lovers}",
"child_death": "Dein Kind {characterName} ist im Alter von {ageYears} Jahren verstorben.{regionLabel}",

View File

@@ -33,6 +33,7 @@
},
"notifications": {
"notify_election_created": "A new election has been scheduled.",
"notify_office_filled": "A political office has been filled.",
"director_death": "{characterName} died at the age of {ageYears}. As employer you need to appoint a new director.{regionLabel}{spouses}{children}{lovers}",
"relationship_death": "{characterName} died at the age of {ageYears}.{regionLabel}{spouses}{children}{lovers}",
"child_death": "Your child {characterName} died at the age of {ageYears}.{regionLabel}",

View File

@@ -47,6 +47,7 @@
},
"notifications": {
"notify_election_created": "Se ha convocado una nueva elección.",
"notify_office_filled": "Se ha cubierto un cargo político.",
"director_death": "{characterName} ha fallecido a la edad de {ageYears} años. Como empleador debes nombrar un nuevo director.{regionLabel}{spouses}{children}{lovers}",
"relationship_death": "{characterName} ha fallecido a la edad de {ageYears} años.{regionLabel}{spouses}{children}{lovers}",
"child_death": "Tu hijo/a {characterName} ha fallecido a la edad de {ageYears} años.{regionLabel}",

View File

@@ -47,6 +47,7 @@
},
"notifications": {
"notify_election_created": "Une nouvelle élection a été déclenchée.",
"notify_office_filled": "Une fonction politique a été pourvue.",
"director_death": "{characterName} est décédé à l'âge de {ageYears}. En tant qu'employeur, vous devez remplir le conseil d'administration.{regionLabel}{spouses}{children}{lovers}",
"relationship_death": "{characterName} est décédé à l'âge de {ageYears}.{regionLabel}{spouses}{children}{lovers}",
"child_death": "Votre enfant {characterName} est décédé à l'âge de {ageYears}.{regionLabel}",