From 64b2b4bd85c92804ca29006b94a98b6c32b010b0 Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Tue, 4 Jun 2024 11:19:39 +0200 Subject: [PATCH] Fix: Handle case if "pop_carry_over_start_time_range" and "pop_carry_over_end_time_range" is not given in tariff file. --- library/src/calculator_functions.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/library/src/calculator_functions.cpp b/library/src/calculator_functions.cpp index b48e3e0..5173f32 100644 --- a/library/src/calculator_functions.cpp +++ b/library/src/calculator_functions.cpp @@ -689,6 +689,18 @@ CalcState Calculator::isParkingAllowedForWeekDay(Configuration const *cfg, int const pop_carry_over_start_time_range = cfg->getPaymentOptions(paymentOptionIndex).pop_carry_over_start_time_range; int const pop_carry_over_end_time_range = cfg->getPaymentOptions(paymentOptionIndex).pop_carry_over_end_time_range; + // qCritical() << DBG_HEADER + // << "pop_carry_over_start_time_range" << pop_carry_over_start_time_range + // << "pop_carry_over_end_time_range" << pop_carry_over_end_time_range; + + if ((int)cfg->TimeRange.count(pop_carry_over_start_time_range) <= 0 && + (int)cfg->TimeRange.count(pop_carry_over_end_time_range) <= 0) { + + qCritical() << DBG_HEADER << "PARKING_ALLOWED. startTime" << startTime.toString(Qt::ISODate); + return CalcState(CalcState::State::SUCCESS, "PARKING_ALLOWED", startTime); + + } else + // search entry in time-range-field of tariff-file if (cfg->TimeRange.count(pop_carry_over_start_time_range) == 1 && cfg->TimeRange.count(pop_carry_over_end_time_range) == 1) {