Refine price comparison logic in FalukantService to include a tolerance for rounding errors

- Updated the price comparison condition to account for a small tolerance (0.001) when determining if the calculated price in a city exceeds the current price, improving accuracy in pricing evaluations.
This commit is contained in:
Torsten Schulz (local)
2025-12-02 15:57:29 +01:00
parent 956418f5f3
commit 3d6fdc65d2

View File

@@ -3738,7 +3738,8 @@ class FalukantService extends BaseService {
const priceInCity = min + (max - min) * (knowledgeFactor / 100); const priceInCity = min + (max - min) * (knowledgeFactor / 100);
// Nur Städte zurückgeben, wo der Preis höher ist // Nur Städte zurückgeben, wo der Preis höher ist
if (priceInCity > currentPrice) { // Verwende eine kleine Toleranz (0.001) um Rundungsfehler zu vermeiden
if (priceInCity > currentPrice + 0.001) {
// Branch-Typ bestimmen // Branch-Typ bestimmen
let branchType = null; // null = kein Branch let branchType = null; // null = kein Branch
if (city.branches && city.branches.length > 0) { if (city.branches && city.branches.length > 0) {