GetDurationFromCost():
Fix computation of end-time when pop_accumulate_durations is set in tariff-file.
This commit is contained in:
parent
465b2274a1
commit
0856f10ca9
@ -181,8 +181,8 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg,
|
|||||||
price = pra_price;
|
price = pra_price;
|
||||||
}
|
}
|
||||||
|
|
||||||
//qCritical() << DBG_HEADER << " PRICE" << price << "COST" << cost;
|
// qCritical() << DBG_HEADER << " PRICE" << price << "COST" << cost;
|
||||||
//qCritical() << DBG_HEADER << " duration id" << durationId;
|
// qCritical() << DBG_HEADER << " duration id" << durationId;
|
||||||
|
|
||||||
auto search = cfg->Duration.find(durationId);
|
auto search = cfg->Duration.find(durationId);
|
||||||
if (search != cfg->Duration.end()) {
|
if (search != cfg->Duration.end()) {
|
||||||
@ -207,11 +207,16 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg,
|
|||||||
//found = true;
|
//found = true;
|
||||||
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") duration_previous" << duration_previous;
|
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") duration_previous" << duration_previous;
|
||||||
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") duration in minutes" << durationInMinutes;
|
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") duration in minutes" << durationInMinutes;
|
||||||
QDateTime d(inputDate.addSecs(duration_previous * 60));
|
QDateTime d;
|
||||||
|
if (pop_accumulate_durations) {
|
||||||
|
d = inputDate.addSecs(durationInMinutes * 60);
|
||||||
|
} else {
|
||||||
|
d = inputDate.addSecs(duration_previous * 60);
|
||||||
|
}
|
||||||
|
|
||||||
qCritical() << DBG_HEADER << " provided price (cost):" << cost;
|
qCritical() << DBG_HEADER << " provided price (cost):" << cost;
|
||||||
qCritical() << DBG_HEADER << " computed time for price (minutes):" << duration_previous;
|
qCritical() << DBG_HEADER << " computed time for price (minutes):" << duration_previous;
|
||||||
qCritical() << DBG_HEADER << "configured minimal parking time (minutes):" << cfg->getPaymentOptions(paymentOptionIndex).pop_min_time;
|
qCritical() << DBG_HEADER << " minimal parking time (minutes):" << cfg->getPaymentOptions(paymentOptionIndex).pop_min_time;
|
||||||
|
|
||||||
if (duration_previous < cfg->getPaymentOptions(paymentOptionIndex).pop_min_time) {
|
if (duration_previous < cfg->getPaymentOptions(paymentOptionIndex).pop_min_time) {
|
||||||
return CalcState::BELOW_MIN_PARKING_TIME.toStdString(); // minimal parking time is set by GetTimeSteps()
|
return CalcState::BELOW_MIN_PARKING_TIME.toStdString(); // minimal parking time is set by GetTimeSteps()
|
||||||
|
Loading…
Reference in New Issue
Block a user