Add debug logging for product price retrieval in FalukantService and RevenueSection

- Introduced console logs in FalukantService to trace the parameters used in the getProductPricesInCities method, enhancing visibility into the product price retrieval process.
- Added logging in RevenueSection to capture the loading process and received better prices for products, improving traceability and debugging capabilities during price loading operations.
This commit is contained in:
Torsten Schulz (local)
2025-12-03 08:58:07 +01:00
parent 5d01b24c2d
commit fe14c7b9f5
2 changed files with 4 additions and 0 deletions

View File

@@ -3671,6 +3671,7 @@ class FalukantService extends BaseService {
} }
async getProductPricesInCities(hashedUserId, productId, currentPrice, currentRegionId = null) { 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 user = await this.getFalukantUserByHashedId(hashedUserId);
const character = await FalukantCharacter.findOne({ where: { userId: user.id } }); const character = await FalukantCharacter.findOne({ where: { userId: user.id } });
if (!character) { if (!character) {

View File

@@ -99,11 +99,13 @@
} }
}, },
async loadPricesForAllProducts() { async loadPricesForAllProducts() {
console.log(`[RevenueSection] loadPricesForAllProducts called, products: ${this.products.length}, currentRegionId: ${this.currentRegionId}`);
for (const product of this.products) { for (const product of this.products) {
if (this.loadingPrices.has(product.id)) continue; if (this.loadingPrices.has(product.id)) continue;
this.loadingPrices.add(product.id); this.loadingPrices.add(product.id);
try { try {
const currentPrice = parseFloat(this.calculateProductRevenue(product).absolute); const currentPrice = parseFloat(this.calculateProductRevenue(product).absolute);
console.log(`[RevenueSection] Loading prices for product ${product.id} (${product.labelTr}), currentPrice: ${currentPrice}, currentRegionId: ${this.currentRegionId}`);
const { data } = await apiClient.get('/api/falukant/products/prices-in-cities', { const { data } = await apiClient.get('/api/falukant/products/prices-in-cities', {
params: { params: {
productId: product.id, productId: product.id,
@@ -111,6 +113,7 @@
currentRegionId: this.currentRegionId currentRegionId: this.currentRegionId
} }
}); });
console.log(`[RevenueSection] Received better prices for product ${product.id}:`, data);
this.$set(product, 'betterPrices', data || []); this.$set(product, 'betterPrices', data || []);
} catch (error) { } catch (error) {
console.error(`Error loading prices for product ${product.id}:`, error); console.error(`Error loading prices for product ${product.id}:`, error);