From e5629ba4fdbcfa31c198e41d2825de87ff630034 Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Wed, 31 Jul 2024 10:25:03 +0200 Subject: [PATCH] GetDurationFromCost(): Check if given price is below minimal parking price. --- library/src/calculator_functions.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/library/src/calculator_functions.cpp b/library/src/calculator_functions.cpp index 9df6563..166bd31 100644 --- a/library/src/calculator_functions.cpp +++ b/library/src/calculator_functions.cpp @@ -145,6 +145,14 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg, qCritical() << DBG_HEADER << " time steps:" << tsteps; if (paymentMethodId == PaymentMethod::Degressive) { + + if (static_cast(cost) < cfg->getPaymentOptions(paymentOptionIndex).pop_min_price) { + // minimal price is set by GetTimeSteps() + qCritical() << DBG_HEADER << " provided price (cost):" << cost; + qCritical() << DBG_HEADER << "configured minimal price:" << cfg->getPaymentOptions(paymentOptionIndex).pop_min_price; + return CalcState::BELOW_MIN_PARKING_PRICE.toStdString(); + } + if (prepaid == false) { int const pop_id = cfg->getPaymentOptions(paymentOptionIndex).pop_id; int const pop_accumulate_prices = cfg->getPaymentOptions(paymentOptionIndex).pop_accumulate_prices;