From ab3cdb32ae81506c3b323151e48a2b24f907a079 Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Mon, 30 Sep 2024 16:55:25 +0200 Subject: [PATCH] compute_next_timestep(): Restrict time-step-list when time-limit has been reached: +/-_button does not move upward anymore. --- library/src/calculate_price.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/library/src/calculate_price.cpp b/library/src/calculate_price.cpp index 6c8b119..0cd5f59 100644 --- a/library/src/calculate_price.cpp +++ b/library/src/calculate_price.cpp @@ -484,6 +484,15 @@ int CALCULATE_LIBRARY_API compute_next_timestep(parking_tariff_t *tariff, int cu qCritical() << __LINE__ << "compute_next_timestep() currentTimeMinutes: " << currentTimeMinutes; qCritical() << __LINE__ << "compute_next_timestep() up/down (1=up, 0=down): " << UpDown; + if (UpDown == 1) { + if (Calculator::GetInstance().timeLimitReached()) { + qCritical() << __LINE__ << "compute_next_timestep() time limit reached"; + Calculator::GetInstance().setTimeLimitReached(false); + Calculator::GetInstance().resetCostAtTimeLimit(); + return currentTimeMinutes; + } + } + // FIXME //std::optional paymentOption = tariff->getPaymentOptionForKey(permitType.get()); //if (!paymentOption.has_value()) {