feat(falukant): enhance product pricing and nobility advancement features
All checks were successful
Deploy to production / deploy (push) Successful in 2m52s

- Updated the `getAllProductPricesInRegion` method in `FalukantService` to accept additional parameters for network worth and branch ID, improving pricing calculations based on user branches.
- Enhanced the nobility advancement logic in `NobilityView` to display unmet requirements clearly, providing users with better feedback on advancement conditions.
- Refactored the revenue calculation in `ProductionSection` to utilize a cached product prices object, optimizing performance and reducing redundant API calls.
- Updated localization files to include new translations for attack sources across multiple languages, enhancing the user experience for diverse audiences.
- Removed obsolete C++ worker references and streamlined the retention logic for production logs, ensuring efficient data management.
This commit is contained in:
Torsten Schulz (local)
2026-04-09 09:08:32 +02:00
parent 360bb59a4e
commit 1118a691b9
20 changed files with 216 additions and 85 deletions

View File

@@ -30,7 +30,6 @@ void UserCharacterWorker::run() {
processCharacterEvents();
updateCharactersMood();
handleCredits();
deleteOldProductionLogs();
} catch (const std::exception &e) {
std::cerr << "[UserCharacterWorker] Fehler in processCharacterEvents: " << e.what() << std::endl;
}
@@ -234,17 +233,6 @@ void UserCharacterWorker::setNewMoney(int falukantUserId, double newAmount) {
});
}
void UserCharacterWorker::deleteOldProductionLogs() {
try {
ConnectionGuard connGuard(pool);
auto &db = connGuard.get();
db.prepare("QUERY_DELETE_OLD_PRODUCTIONS", QUERY_DELETE_OLD_PRODUCTIONS);
db.execute("QUERY_DELETE_OLD_PRODUCTIONS");
} catch (const std::exception &e) {
std::cerr << "[UserCharacterWorker] Fehler in deleteOldProductionLogs: " << e.what() << std::endl;
}
}
void UserCharacterWorker::recalculateKnowledge() {
setCurrentStep("Get character data");
ConnectionGuard connGuard(pool);

View File

@@ -25,7 +25,6 @@ private:
int calculateHealthChange(int age);
void handleCharacterDeath(int characterId);
void recalculateKnowledge();
void deleteOldProductionLogs();
void processPregnancies();
void handleCredits();
void setHeir(int characterId);
@@ -62,13 +61,7 @@ private:
static constexpr const char *QUERY_UPDATE_GET_ITEMS_TO_UPDATE = R"(
SELECT id, product_id, producer_id, quantity
FROM falukant_log.production p
WHERE (COALESCE(p.production_timestamp, p.production_date::timestamp))::date < CURRENT_DATE
)";
/** Log-Retention: ältere Zeilen entfernen (Daemon/UI-Zertifikatszählung braucht Historie nur begrenzt). */
static constexpr const char *QUERY_DELETE_OLD_PRODUCTIONS = R"(
DELETE FROM falukant_log.production
WHERE COALESCE(production_timestamp, production_date::timestamp) < NOW() - INTERVAL '30 days'
WHERE p.production_timestamp::date < current_date
)";
static constexpr const char *QUERY_UPDATE_GET_CHARACTER_IDS = R"(

View File

@@ -72,9 +72,8 @@ void ValueRecalculationWorker::calculateProductKnowledge() {
sendMessageToFalukantUsers(userId, message);
}
/* Kein DELETE mehr auf falukant_log.production um Mitternacht: Die Einträge werden für
* Zertifikatsfortschritt (Backend + Daemon) benötigt.
* UserCharacterWorker: nach Wissens-Update pro Zeile löschen; zusätzlich stündlich Retention
* QUERY_DELETE_OLD_PRODUCTIONS (30 Tage, COALESCE(timestamp, production_date)). */
* Zertifikatsfortschritt (u. a. Backend-Aggregation) benötigt und dürfen nicht täglich verworfen werden.
* Alte Zeilen räumt der UserCharacterWorker nach Wissens-Update weiterhin gezielt auf (pro Zeile). */
}
void ValueRecalculationWorker::calculateRegionalSellPrice() {

View File

@@ -42,7 +42,7 @@ private:
SET knowledge = LEAST(100, k.knowledge + 1)
FROM falukant_data."character" c
JOIN falukant_log.production p
ON DATE(COALESCE(p.production_timestamp, p.production_date::timestamp)) = CURRENT_DATE - INTERVAL '1 day'
ON DATE(p.production_timestamp) = CURRENT_DATE - INTERVAL '1 day'
WHERE c.id = k.character_id
AND c.user_id = 18
AND k.product_id = 10
@@ -51,7 +51,7 @@ private:
static constexpr const char *QUERY_GET_PRODUCERS_LAST_DAY = R"(
select p."producer_id"
from falukant_log.production p
where date(COALESCE(p.production_timestamp, p.production_date::timestamp)) = CURRENT_DATE - interval '1 day'
where date(p."production_timestamp") = CURRENT_DATE - interval '1 day'
group by producer_id
)";