From d82a732a8d7038480a408dc192fb8daf12c2d537 Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Tue, 1 Apr 2025 14:26:21 +0200 Subject: [PATCH] if end of parking time equals carry-over-end, then, if configured, go back to carry-over-start. --- library/src/calculate_price.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/library/src/calculate_price.cpp b/library/src/calculate_price.cpp index 45545ef..acf8980 100644 --- a/library/src/calculate_price.cpp +++ b/library/src/calculate_price.cpp @@ -948,7 +948,16 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket( ATBPaymentOption const &po = tariff->getPaymentOptions(paymentOptionIndex); if (po.pop_apply_carry_over_to_ticket_endtime) { end_parking_time = end_parking_time.addSecs(carryOverDuration * 60); - qCritical() << __func__ << ":" << __LINE__ << "end-parking-time:" << end_parking_time.toString(Qt::ISODate); + qCritical() << __func__ << ":" << __LINE__ << "adapted end-parking-time:" << end_parking_time.toString(Qt::ISODate); + } + } else + if (end_parking_time.time() == carryOverEnd) { + qCritical() << __func__ << ":" << __LINE__ << " end-parking-time:" << end_parking_time.toString(Qt::ISODate); + qCritical() << __func__ << ":" << __LINE__ << " carryOverEnd:" << carryOverEnd.toString(Qt::ISODate); + ATBPaymentOption const &po = tariff->getPaymentOptions(paymentOptionIndex); + if (po.pop_apply_carry_over_to_ticket_endtime == false) { + end_parking_time = end_parking_time.addSecs(-carryOverDuration * 60); + qCritical() << __func__ << ":" << __LINE__ << "adapted end-parking-time:" << end_parking_time.toString(Qt::ISODate); } } } else {