From 57b9d16abc1181d2915e9c6e511a8f3b7b1605dc Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Mon, 16 Sep 2024 16:50:16 +0200 Subject: [PATCH] GetDurationFromCost(): Handle carry-over for direct coin insertion. Carefully check if this might be a problem for other projects. --- library/src/calculator_functions.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/library/src/calculator_functions.cpp b/library/src/calculator_functions.cpp index aa1e58e..5333919 100644 --- a/library/src/calculator_functions.cpp +++ b/library/src/calculator_functions.cpp @@ -533,6 +533,16 @@ Calculator::GetDurationFromCost(Configuration* cfg, //qCritical() << DBG_HEADER << "NEW INPUT" << inputDate.toString(Qt::ISODate); + int const pop_carry_over = cfg->getPaymentOptions(paymentOptionIndex).pop_carry_over; + if (pop_carry_over) { + int weekDay = inputDate.date().dayOfWeek(); + int const pop_carry_over_option_id = cfg->getPaymentOptions(paymentOptionIndex).pop_carry_over_option_id; + if (pop_carry_over_option_id != -1) { + int const carryOverDuration = cfg->TariffCarryOverOptions.find(pop_carry_over_option_id)->second.carryover[weekDay].duration; + inputDate = inputDate.addSecs(carryOverDuration * 60); + } + } + inputDate = inputDate.addSecs(durationInSecs); #if DEBUG_GET_DURATION_FROM_COST==1 qCritical() << DBG_HEADER << "TICKET-END" << inputDate.toString(Qt::ISODate);