GetDurationFromCost():

Handle carry-over for direct coin insertion.
	Carefully check if this might be a problem for other projects.
This commit is contained in:
Gerhard Hoffmann 2024-09-16 16:50:16 +02:00
parent 48afbc071c
commit 57b9d16abc

View File

@ -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);