Check if prepaid-option is set.

This commit is contained in:
Gerhard Hoffmann 2024-08-02 11:08:52 +02:00
parent 1152c3824e
commit 3dda2d8355

View File

@ -797,11 +797,15 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket(
std::optional<ATBPrepaid> prepaidOption = tariff->getPrepaidType(prepaid_option_id);
if (prepaidOption.has_value()) {
ATBPrepaid const &p = prepaidOption.value();
if (start_parking_time.time() < p.static_end) { // static_end: e.g. 08:00:00
effectiveStartTime.setTime(p.static_end);
} else
if (start_parking_time.time() > p.static_start) { // static_start: e.g. 22:00:00
effectiveStartTime.setTime(p.static_start);
if (p.never) {
qCritical() << __func__ << __LINE__ << "prepaid: no";
} else {
if (start_parking_time.time() < p.static_end) { // static_end: e.g. 08:00:00
effectiveStartTime.setTime(p.static_end);
} else
if (start_parking_time.time() > p.static_start) { // static_start: e.g. 22:00:00
effectiveStartTime.setTime(p.static_start);
}
}
}