GetTimeSteps(): use pop_accumulate_durations to properly compute time steps
such that following functions comuting a price have the same behaviour.
This commit is contained in:
parent
77ca6a4736
commit
b303a59964
@ -1452,8 +1452,8 @@ CalcState Calculator::isParkingAllowed(Configuration const *cfg,
|
|||||||
int netto_parking_time,
|
int netto_parking_time,
|
||||||
int paymentOptionIndex) {
|
int paymentOptionIndex) {
|
||||||
|
|
||||||
qCritical() << DBG_HEADER << "CHECK IF PARKING IS ALLOWED AT"
|
//qCritical() << DBG_HEADER << "CHECK IF PARKING IS ALLOWED AT"
|
||||||
<< start.toString(Qt::ISODate) << "...";
|
// << start.toString(Qt::ISODate) << "...";
|
||||||
|
|
||||||
CalcState cs;
|
CalcState cs;
|
||||||
|
|
||||||
@ -2681,6 +2681,8 @@ QList<int> &Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex,
|
|||||||
std::optional<QDateTime> prepaidStart = cfg->prepaidStart(start, pop_prepaid_option_id);
|
std::optional<QDateTime> prepaidStart = cfg->prepaidStart(start, pop_prepaid_option_id);
|
||||||
// TODO: zusaetzlicher faktor falls vorkauf-option zieht
|
// TODO: zusaetzlicher faktor falls vorkauf-option zieht
|
||||||
if (prepaidStart) {
|
if (prepaidStart) {
|
||||||
|
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") start:" << start.toString(Qt::ISODate);
|
||||||
|
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") prepaid start value:" << prepaidStart.value().toString(Qt::ISODate);
|
||||||
start = prepaidStart.value();
|
start = prepaidStart.value();
|
||||||
if (DBG_LEVEL >= DBG_DEBUG) {
|
if (DBG_LEVEL >= DBG_DEBUG) {
|
||||||
qCritical() << "(" << __func__ << ":" << __LINE__ << ") prepaid adapted start:" << start.toString(Qt::ISODate);
|
qCritical() << "(" << __func__ << ":" << __LINE__ << ") prepaid adapted start:" << start.toString(Qt::ISODate);
|
||||||
@ -2698,9 +2700,11 @@ QList<int> &Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex,
|
|||||||
qCritical() << "(" << __func__ << ":" << __LINE__ << ") interpolation end:" << interpolationEnd.toString(Qt::ISODate);
|
qCritical() << "(" << __func__ << ":" << __LINE__ << ") interpolation end:" << interpolationEnd.toString(Qt::ISODate);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// qCritical() << "(" << __func__ << ":" << __LINE__ << ") TODO";
|
qCritical() << "(" << __func__ << ":" << __LINE__ << ") TODO";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// qCritical() << "(" << __func__ << ":" << __LINE__ << ") start:" << start.toString(Qt::ISODate);
|
||||||
|
|
||||||
// int const start_time = start.time().hour() * 60 + start.time().minute();
|
// int const start_time = start.time().hour() * 60 + start.time().minute();
|
||||||
QDateTime nextTimeStep = start;
|
QDateTime nextTimeStep = start;
|
||||||
int runtimeInMinutes = 0;
|
int runtimeInMinutes = 0;
|
||||||
@ -2743,7 +2747,7 @@ QList<int> &Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") runtime in minutes:" << runtimeInMinutes;
|
// qCritical() << "(" << __func__ << ":" << __LINE__ << ") runtime in minutes:" << runtimeInMinutes;
|
||||||
|
|
||||||
std::optional<ATBInterpolation> ipolCheck = cfg->getInterpolationType(duration.pun_interpolation_id);
|
std::optional<ATBInterpolation> ipolCheck = cfg->getInterpolationType(duration.pun_interpolation_id);
|
||||||
if (ipolCheck) {
|
if (ipolCheck) {
|
||||||
@ -2764,11 +2768,12 @@ QList<int> &Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex,
|
|||||||
// qCritical() << "(" << __func__ << ":" << __LINE__ << ") interpolation dynamic end time:" << end_time;
|
// qCritical() << "(" << __func__ << ":" << __LINE__ << ") interpolation dynamic end time:" << end_time;
|
||||||
|
|
||||||
int pop_min_time = cfg->getPaymentOptions(paymentOptionIndex).pop_min_time;
|
int pop_min_time = cfg->getPaymentOptions(paymentOptionIndex).pop_min_time;
|
||||||
|
bool pop_accumulate_durations = cfg->getPaymentOptions(paymentOptionIndex).pop_accumulate_durations;
|
||||||
|
|
||||||
runtimeInMinutes += duration.pun_duration;
|
runtimeInMinutes += duration.pun_duration;
|
||||||
nextTimeStep = start.addSecs(runtimeInMinutes * 60);
|
nextTimeStep = start.addSecs(runtimeInMinutes * 60);
|
||||||
|
|
||||||
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") runtime in minutes (1):" << runtimeInMinutes;
|
// qCritical() << "(" << __func__ << ":" << __LINE__ << ") runtime in minutes (1):" << runtimeInMinutes;
|
||||||
|
|
||||||
if (nextTimeStep.time() > carryOverStart) {
|
if (nextTimeStep.time() > carryOverStart) {
|
||||||
int const backTime = carryOverStart.secsTo(nextTimeStep.time()) / 60;
|
int const backTime = carryOverStart.secsTo(nextTimeStep.time()) / 60;
|
||||||
@ -2793,17 +2798,19 @@ QList<int> &Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex,
|
|||||||
//}
|
//}
|
||||||
} else {
|
} else {
|
||||||
m_timeSteps[paymentOptionIndex] << runtimeInMinutes;
|
m_timeSteps[paymentOptionIndex] << runtimeInMinutes;
|
||||||
|
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") :" << m_timeSteps[paymentOptionIndex];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pop_accumulate_durations == false) {
|
||||||
duration.pun_duration = runtimeInMinutes;
|
duration.pun_duration = runtimeInMinutes;
|
||||||
|
qCritical() << "(" << __func__ << ":" << __LINE__ << ") pun_id:" << duration.pun_id;
|
||||||
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") pun_id:" << duration.pun_id;
|
qCritical() << "(" << __func__ << ":" << __LINE__ << ") pun_duration:" << duration.pun_duration;
|
||||||
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") pun_duration:" << duration.pun_duration;
|
|
||||||
|
|
||||||
search->second = duration;
|
search->second = duration;
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
if (duration.pun_interpolation_id == (int)ATBInterpolation::NO_INTERPOLATION) {
|
if (duration.pun_interpolation_id == (int)ATBInterpolation::NO_INTERPOLATION) {
|
||||||
|
qCritical() << "(" << __func__ << ":" << __LINE__ << ")" ;
|
||||||
|
|
||||||
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") pun_id:" << duration.pun_id;
|
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") pun_id:" << duration.pun_id;
|
||||||
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") paymentOptionIndex:" << paymentOptionIndex;
|
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") paymentOptionIndex:" << paymentOptionIndex;
|
||||||
@ -2895,7 +2902,7 @@ QList<int> &Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex,
|
|||||||
// duration.pun_duration = runtimeInMinutes - carryOverDuration;
|
// duration.pun_duration = runtimeInMinutes - carryOverDuration;
|
||||||
m_timeSteps[paymentOptionIndex] << duration.pun_duration;
|
m_timeSteps[paymentOptionIndex] << duration.pun_duration;
|
||||||
search->second = duration;
|
search->second = duration;
|
||||||
} else {
|
} else { // if (duration.pun_interpolation_id == (int)ATBInterpolation::NO_INTERPOLATION) {
|
||||||
cfg->Duration.erase(search);
|
cfg->Duration.erase(search);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3002,7 +3009,7 @@ uint32_t Calculator::GetPriceForTimeStep(Configuration *cfg, int timeStep, int p
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (timeStep == pun_duration) {
|
if (timeStep == pun_duration) {
|
||||||
qCritical() << "(" << __func__ << ":" << __LINE__ << ") return price" << price;
|
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") return price" << price;
|
||||||
return price;
|
return price;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3014,7 +3021,9 @@ uint32_t Calculator::GetDurationForPrice(Configuration *cfg, int price) const {
|
|||||||
int const pop_id = cfg->getPaymentOptions().pop_id;
|
int const pop_id = cfg->getPaymentOptions().pop_id;
|
||||||
int const pop_accumulate_prices = cfg->getPaymentOptions().pop_accumulate_prices;
|
int const pop_accumulate_prices = cfg->getPaymentOptions().pop_accumulate_prices;
|
||||||
|
|
||||||
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") accumulate prices" << pop_accumulate_prices;
|
qCritical() << "(" << __func__ << ":" << __LINE__ << ") accumulate prices" << pop_accumulate_prices;
|
||||||
|
qCritical() << "(" << __func__ << ":" << __LINE__ << ") pop_id" << pop_id;
|
||||||
|
qCritical() << "(" << __func__ << ":" << __LINE__ << ") price" << price;
|
||||||
|
|
||||||
int new_price = 0;
|
int new_price = 0;
|
||||||
uint32_t duration = 0;
|
uint32_t duration = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user