From fa10ea4b89b875576fa0ed0b5319108312f34894 Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Wed, 11 Sep 2024 11:49:31 +0200 Subject: [PATCH] compute_price_for_parking_ticket(): In case parking-time-limit is violated, return with an error. Commented out: use another possiblity: cut max-parking-time so that parking-time-limit is not violated. --- library/src/calculate_price.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/library/src/calculate_price.cpp b/library/src/calculate_price.cpp index 0697b9b..5dfdf37 100644 --- a/library/src/calculate_price.cpp +++ b/library/src/calculate_price.cpp @@ -891,12 +891,14 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket( end_parking_time, paymentOptionIndex); if (parkTimeLimitViolated) { + //QTime const &tlimit = wd.getTariffCarryOverSettings().parkingTimeLimit(); + //end_parking_time.setTime(tlimit); + calcState.setDesc(QString("line=%1 endTime=%2: park-time-limit violated").arg(__LINE__) - .arg(end_parking_time.time().toString(Qt::ISODate))); + .arg(end_parking_time.time().toString(Qt::ISODate))); return calcState.set(CalcState::State::ABOVE_MAX_PARKING_TIME); } } - } else { cost = Calculator::GetInstance().GetCostFromDuration( tariff, @@ -1181,6 +1183,9 @@ CalcState CALCULATE_LIBRARY_API compute_duration_for_parking_ticket( ticketEndTime, paymentOptionIndex); if (parkTimeLimitViolated) { + //QTime const &tlimit = wd.getTariffCarryOverSettings().parkingTimeLimit(); + //ticketEndTime.setTime(tlimit); + calcState.setDesc(QString("line=%1 endTime=%2: park-time-limit violated").arg(__LINE__) .arg(ticketEndTime.time().toString(Qt::ISODate))); return calcState.set(CalcState::State::ABOVE_MAX_PARKING_TIME);