get_minimal_parkingtime(): const Configuration parameter.
Cast of const pointer necessary. get_maximal_parkingtime(): const Configuration parameter.
This commit is contained in:
parent
f93cf11d23
commit
1dd81d4a56
@ -14,7 +14,7 @@ QList<int> CALCULATE_LIBRARY_API get_time_steps(Configuration *cfg) {
|
||||
return Calculator::GetInstance().GetTimeSteps(cfg);
|
||||
}
|
||||
|
||||
int CALCULATE_LIBRARY_API get_minimal_parkingtime(Configuration *cfg,
|
||||
int CALCULATE_LIBRARY_API get_minimal_parkingtime(Configuration const *cfg,
|
||||
PERMIT_TYPE permitType,
|
||||
int paymentOptionIndex) {
|
||||
int minTime = 0;
|
||||
@ -33,14 +33,14 @@ int CALCULATE_LIBRARY_API get_minimal_parkingtime(Configuration *cfg,
|
||||
// for each new sell-procedure, recomute the timesteps. implicitly, set
|
||||
// the minimal parking time.
|
||||
Calculator::GetInstance().ResetTimeSteps(paymentOptionIndex);
|
||||
Calculator::GetInstance().GetTimeSteps(cfg, paymentOptionIndex);
|
||||
Calculator::GetInstance().GetTimeSteps((Configuration *)cfg, paymentOptionIndex);
|
||||
minTime = qRound(cfg->getPaymentOptions(paymentOptionIndex).pop_min_time);
|
||||
}
|
||||
|
||||
return minTime;
|
||||
}
|
||||
|
||||
int CALCULATE_LIBRARY_API get_maximal_parkingtime(Configuration *cfg,
|
||||
int CALCULATE_LIBRARY_API get_maximal_parkingtime(Configuration const *cfg,
|
||||
PERMIT_TYPE permitType,
|
||||
int paymentOptionIndex) {
|
||||
int maxTime = 0;
|
||||
@ -59,6 +59,7 @@ int CALCULATE_LIBRARY_API get_maximal_parkingtime(Configuration *cfg,
|
||||
}
|
||||
|
||||
return maxTime;
|
||||
|
||||
}
|
||||
|
||||
int CALCULATE_LIBRARY_API get_minimal_parkingprice(Configuration *cfg,
|
||||
@ -156,6 +157,28 @@ int CALCULATE_LIBRARY_API compute_product_price(Configuration const *cfg,
|
||||
return product_price;
|
||||
}
|
||||
} break;
|
||||
case PERMIT_TYPE::TWENTY_FOUR_HOURS_TICKET: {
|
||||
std::optional<QVector<ATBTariffProduct>> products = cfg->getTariffProductForProductId(permitType);
|
||||
if (products) {
|
||||
int product_price = 0;
|
||||
QVector<ATBTariffProduct> product = products.value();
|
||||
|
||||
if (product.size() > 0) {
|
||||
if (productStart && productEnd) {
|
||||
int pop_min_time = get_minimal_parkingtime(cfg); // in minutes
|
||||
int pop_max_time = get_maximal_parkingtime(cfg); // in minutes
|
||||
if (pop_max_time >= pop_min_time) {
|
||||
*productStart = start;
|
||||
*productEnd = start.addSecs(pop_max_time*60);
|
||||
product_price = product[0].getProductPrice();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return product_price;
|
||||
}
|
||||
|
||||
} break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user