Refactor and remove debug logging in FalukantService and RevenueSection for cleaner code

- Eliminated console logs in the getProductPricesInCities method of FalukantService to streamline the price calculation process and reduce clutter in the output.
- Removed unnecessary debug logs in RevenueSection related to loading product prices, enhancing performance and focusing on essential functionality.
- Improved overall code readability by reducing logging noise while maintaining necessary functionality.
This commit is contained in:
Torsten Schulz (local)
2025-12-03 11:35:13 +01:00
parent 56c3569b68
commit 90fbcaf31d
2 changed files with 0 additions and 13 deletions

View File

@@ -3671,7 +3671,6 @@ class FalukantService extends BaseService {
}
async getProductPricesInCities(hashedUserId, productId, currentPrice, currentRegionId = null) {
console.log(`[getProductPricesInCities] Called with productId: ${productId}, currentPrice: ${currentPrice}, currentRegionId: ${currentRegionId}`);
const user = await this.getFalukantUserByHashedId(hashedUserId);
const character = await FalukantCharacter.findOne({ where: { userId: user.id } });
if (!character) {
@@ -3726,11 +3725,9 @@ class FalukantService extends BaseService {
// Für jede Stadt den Preis berechnen und Branch-Typ bestimmen
const results = [];
console.log(`[getProductPricesInCities] Processing ${cities.length} cities for product ${productId}, knowledgeFactor: ${knowledgeFactor}, product.sellCost: ${product.sellCost}`);
for (const city of cities) {
// Aktuelle Stadt ausschließen
if (currentRegionId && city.id === currentRegionId) {
console.log(`[getProductPricesInCities] Skipping current city: ${city.name} (${city.id})`);
continue;
}
@@ -3745,8 +3742,6 @@ class FalukantService extends BaseService {
const max = basePrice;
const priceInCity = min + (max - min) * (knowledgeFactor / 100);
console.log(`[getProductPricesInCities] City: ${city.name} (${city.id}), worthPercent: ${worthPercent}, basePrice: ${basePrice}, priceInCity: ${priceInCity}, currentPrice: ${currentPrice}, isBetter: ${priceInCity > currentPrice}`);
// Nur Städte zurückgeben, wo der Preis höher ist
// Keine Toleranz, da wir die aktuelle Stadt bereits ausschließen
if (priceInCity > currentPrice) {
@@ -3762,8 +3757,6 @@ class FalukantService extends BaseService {
}
}
console.log(`[getProductPricesInCities] Adding ${city.name} to results: price=${priceInCity}, branchType=${branchType}`);
results.push({
regionId: city.id,
regionName: city.name,
@@ -3772,8 +3765,6 @@ class FalukantService extends BaseService {
});
}
}
console.log(`[getProductPricesInCities] Returning ${results.length} cities with better prices for product ${productId}:`, results.map(r => `${r.regionName} (${r.price.toFixed(2)})`).join(', '));
// Sortiere nach Preis (höchster zuerst)
results.sort((a, b) => b.price - a.price);