Add debug logging to FalukantService and RevenueSection for better price tracking
- Introduced console logs in FalukantService to trace product price calculations and city evaluations, aiding in debugging and performance monitoring. - Added logging in RevenueSection to capture the loading process and received better prices for products, enhancing visibility into price retrieval operations.
This commit is contained in:
@@ -3725,6 +3725,7 @@ class FalukantService extends BaseService {
|
||||
|
||||
// Für jede Stadt den Preis berechnen und Branch-Typ bestimmen
|
||||
const results = [];
|
||||
console.log(`[getProductPricesInCities] productId: ${productId}, currentPrice: ${currentPrice}, knowledgeFactor: ${knowledgeFactor}, product.sellCost: ${product.sellCost}, cities: ${cities.length}`);
|
||||
for (const city of cities) {
|
||||
// Regionaler Preis-Faktor (worthPercent zwischen 40-60)
|
||||
const worthPercent = worthMap.get(city.id) || 50; // Default 50% wenn nicht gefunden
|
||||
@@ -3737,6 +3738,8 @@ 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 + 0.001}`);
|
||||
|
||||
// Nur Städte zurückgeben, wo der Preis höher ist
|
||||
// Verwende eine kleine Toleranz (0.001) um Rundungsfehler zu vermeiden
|
||||
if (priceInCity > currentPrice + 0.001) {
|
||||
@@ -3764,6 +3767,7 @@ class FalukantService extends BaseService {
|
||||
// Sortiere nach Preis (höchster zuerst)
|
||||
results.sort((a, b) => b.price - a.price);
|
||||
|
||||
console.log(`[getProductPricesInCities] Returning ${results.length} cities with better prices`);
|
||||
return results;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user