get_maximal_parkingprice(): in case of progressive tariff, read maximal parking time
directly form tariff-file as there is not price per hour.
This commit is contained in:
parent
9c19414e5a
commit
690267c388
@ -78,9 +78,13 @@ int CALCULATE_LIBRARY_API get_minimal_parkingprice(Configuration *cfg, PERMIT_TY
|
||||
|
||||
int CALCULATE_LIBRARY_API get_maximal_parkingprice(Configuration *cfg, PERMIT_TYPE permitType) {
|
||||
int maxPrice = -1;
|
||||
static const PaymentMethod paymentMethodId = Utilities::getPaymentMethodId(cfg);
|
||||
|
||||
switch(permitType) {
|
||||
case PERMIT_TYPE::SHORT_TERM_PARKING: { // e.g. szeged (customer_281)
|
||||
if (paymentMethodId == PaymentMethod::Progressive) {
|
||||
maxPrice = Utilities::getMaximalParkingPrice(cfg, paymentMethodId);
|
||||
} else { // PaymentMethod::Linear -> e.g. szeged
|
||||
int const key = cfg->getPaymentOptions().pop_id;
|
||||
int const maxTime = cfg->getPaymentOptions().pop_max_time; // maxTime is given in minutes
|
||||
std::optional<QVector<ATBPaymentRate>> const &pv = cfg->getPaymentRateForKey(key);
|
||||
@ -91,6 +95,7 @@ int CALCULATE_LIBRARY_API get_maximal_parkingprice(Configuration *cfg, PERMIT_TY
|
||||
maxPrice = qRound((maxTime * price) / 60.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
} break;
|
||||
case PERMIT_TYPE::DAY_TICKET_ADULT:
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user