Recompute time step list (previously is was saved as an optimization)
This commit is contained in:
parent
eb4ef0c3b5
commit
2b30e9562f
@ -2123,9 +2123,14 @@ QList<int> &Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (m_timeSteps.size() > paymentOptionIndex) {
|
if (m_timeSteps.size() > paymentOptionIndex) {
|
||||||
if (!m_timeSteps[paymentOptionIndex].isEmpty()) {
|
|
||||||
return m_timeSteps[paymentOptionIndex];
|
//if (!m_timeSteps[paymentOptionIndex].isEmpty()) {
|
||||||
}
|
// return m_timeSteps[paymentOptionIndex];
|
||||||
|
//}
|
||||||
|
|
||||||
|
// recompute time steps
|
||||||
|
m_timeSteps[paymentOptionIndex].clear();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
m_timeSteps.push_back(QList<int>());
|
m_timeSteps.push_back(QList<int>());
|
||||||
}
|
}
|
||||||
@ -2252,6 +2257,7 @@ QList<int> &Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex,
|
|||||||
qCritical() << "(" << __func__ << ":" << __LINE__ << ") TODO";
|
qCritical() << "(" << __func__ << ":" << __LINE__ << ") TODO";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: check if needed
|
||||||
QDateTime interpolationEnd;
|
QDateTime interpolationEnd;
|
||||||
std::optional<QDateTime> interpolationEndDate = cfg->getInterpolationEnd(start, paymentOptionIndex);
|
std::optional<QDateTime> interpolationEndDate = cfg->getInterpolationEnd(start, paymentOptionIndex);
|
||||||
if (interpolationEndDate) {
|
if (interpolationEndDate) {
|
||||||
@ -2269,6 +2275,18 @@ QList<int> &Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex,
|
|||||||
|
|
||||||
int const pop_truncate_last_interpolation_step = cfg->getPaymentOptions(paymentOptionIndex).pop_truncate_last_interpolation_step;
|
int const pop_truncate_last_interpolation_step = cfg->getPaymentOptions(paymentOptionIndex).pop_truncate_last_interpolation_step;
|
||||||
|
|
||||||
|
// TODO: auslagern
|
||||||
|
for (auto[itr, rangeEnd] = cfg->PaymentRate.equal_range(pop_id); itr != rangeEnd; ++itr) {
|
||||||
|
int const durationId = itr->second.pra_payment_unit_id;
|
||||||
|
|
||||||
|
auto search = cfg->Duration.find(durationId);
|
||||||
|
if (search != cfg->Duration.end()) {
|
||||||
|
ATBDuration duration = search->second;
|
||||||
|
duration.pun_duration = duration.pun_duration_saved;
|
||||||
|
search->second = duration;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (auto[itr, rangeEnd] = cfg->PaymentRate.equal_range(pop_id); itr != rangeEnd; ++itr) {
|
for (auto[itr, rangeEnd] = cfg->PaymentRate.equal_range(pop_id); itr != rangeEnd; ++itr) {
|
||||||
int const durationId = itr->second.pra_payment_unit_id;
|
int const durationId = itr->second.pra_payment_unit_id;
|
||||||
// int const price = itr->second.pra_price;
|
// int const price = itr->second.pra_price;
|
||||||
@ -2324,7 +2342,6 @@ QList<int> &Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex,
|
|||||||
int rest = nextTimeStep.secsTo(interpolationEnd);
|
int rest = nextTimeStep.secsTo(interpolationEnd);
|
||||||
if (nextTimeStep <= interpolationEnd) {
|
if (nextTimeStep <= interpolationEnd) {
|
||||||
if (rest > 0 && rest < duration.pun_duration) {
|
if (rest > 0 && rest < duration.pun_duration) {
|
||||||
qCritical() << "(" << __func__ << ":" << __LINE__ << ") TODO TODO:" << rest;
|
|
||||||
qCritical() << "(" << __func__ << ":" << __LINE__ << ") rest minutes:" << rest;
|
qCritical() << "(" << __func__ << ":" << __LINE__ << ") rest minutes:" << rest;
|
||||||
// last time step before switching to dayticket (see Schnals 505/506)
|
// last time step before switching to dayticket (see Schnals 505/506)
|
||||||
//if (duration.pun_duration > 0) {
|
//if (duration.pun_duration > 0) {
|
||||||
@ -2426,6 +2443,8 @@ QList<int> &Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qCritical() << "(" << __func__ << ":" << __LINE__ << ") NEW timeSteps:" << m_timeSteps;
|
||||||
|
|
||||||
if (DBG_LEVEL >= DBG_DEBUG) {
|
if (DBG_LEVEL >= DBG_DEBUG) {
|
||||||
qCritical() << "(" << __func__ << ":" << __LINE__ << ") NEW timeSteps:" << m_timeSteps;
|
qCritical() << "(" << __func__ << ":" << __LINE__ << ") NEW timeSteps:" << m_timeSteps;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user