From 1797ae3e58e07269433021a2eca38421162ed10e Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Wed, 3 Dec 2025 15:55:30 +0100 Subject: [PATCH] Remove debug logging from getProductPricesInCities method in FalukantService - Eliminated console logs that tracked various parameters and results within the getProductPricesInCities method, streamlining the code and reducing output clutter. - This change aims to enhance code readability and maintain focus on essential functionality while maintaining the integrity of the price calculation process. --- backend/services/falukantService.js | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/backend/services/falukantService.js b/backend/services/falukantService.js index 632d2dd..71a0017 100644 --- a/backend/services/falukantService.js +++ b/backend/services/falukantService.js @@ -3671,7 +3671,6 @@ class FalukantService extends BaseService { } async getProductPricesInCities(hashedUserId, productId, currentPrice, currentRegionId = null) { - console.log(`[getProductPricesInCities] Called: productId=${productId}, currentPrice=${currentPrice}, currentRegionId=${currentRegionId}`); const user = await this.getFalukantUserByHashedId(hashedUserId); const character = await FalukantCharacter.findOne({ where: { userId: user.id } }); if (!character) { @@ -3689,7 +3688,6 @@ class FalukantService extends BaseService { where: { characterId: character.id, productId: productId } }); const knowledgeFactor = knowledge?.knowledge || 0; - console.log(`[getProductPricesInCities] product.sellCost=${product.sellCost}, knowledgeFactor=${knowledgeFactor}`); // Alle Städte abrufen const cities = await RegionData.findAll({ @@ -3717,7 +3715,6 @@ class FalukantService extends BaseService { } ] }); - console.log(`[getProductPricesInCities] Found ${cities.length} cities`); // TownProductWorth für alle Städte und dieses Produkt abrufen const townWorths = await TownProductWorth.findAll({ @@ -3725,14 +3722,12 @@ class FalukantService extends BaseService { attributes: ['regionId', 'worthPercent'] }); const worthMap = new Map(townWorths.map(tw => [tw.regionId, tw.worthPercent])); - console.log(`[getProductPricesInCities] Found ${townWorths.length} townWorths entries`); // Für jede Stadt den Preis berechnen und Branch-Typ bestimmen const results = []; 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; } @@ -3747,12 +3742,9 @@ 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 // Kleine Toleranz (0.01) für Rundungsfehler bei Gleitkommaberechnungen const PRICE_TOLERANCE = 0.01; - console.log(`[getProductPricesInCities] priceInCity=${priceInCity}, currentPrice=${currentPrice}, PRICE_TOLERANCE=${PRICE_TOLERANCE}`); if (priceInCity > currentPrice - PRICE_TOLERANCE) { // Branch-Typ bestimmen let branchType = null; // null = kein Branch @@ -3766,7 +3758,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, @@ -3776,7 +3767,6 @@ class FalukantService extends BaseService { } } - console.log(`[getProductPricesInCities] Returning ${results.length} cities with better prices`); // Sortiere nach Preis (höchster zuerst) results.sort((a, b) => b.price - a.price);