compute_price_for_parking_ticket():

If after crossing a carry-over-time range (taking several days)
	check if we have to carry over again on the target day.
This commit is contained in:
Gerhard Hoffmann 2024-09-11 11:47:50 +02:00
parent 03e9076962
commit 05f03a623b

View File

@ -858,6 +858,26 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket(
end_parking_time = effectiveStartTime.addSecs(netto_parking_time*60);
}
qCritical() << __func__ << ":" << __LINE__ << "end-parking-time:" << end_parking_time.toString(Qt::ISODate);
weekDay = end_parking_time.date().dayOfWeek();
// musste man in einer schleife machen
carryOverStart = tariff->TariffCarryOverOptions.find(pop_carry_over_option_id)->second.carryover[weekDay].static_start;
carryOverDuration = tariff->TariffCarryOverOptions.find(pop_carry_over_option_id)->second.carryover[weekDay].duration;
if (end_parking_time.time() > carryOverStart) {
end_parking_time = end_parking_time.addSecs(carryOverDuration * 60);
} else
if (end_parking_time.time() == carryOverStart) {
qCritical() << __func__ << ":" << __LINE__ << "end-parking-time:" << end_parking_time.toString(Qt::ISODate);
qCritical() << __func__ << ":" << __LINE__ << " carryOverStart" << carryOverStart.toString(Qt::ISODate);
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);
}
}
end_parking_time.setTime(QTime(end_parking_time.time().hour(),
end_parking_time.time().minute(), 0));