GetTimeSteps(): return step-list as reference; return only a non-empty step-list.

This commit is contained in:
Gerhard Hoffmann 2024-07-13 13:57:07 +02:00
parent dda04434fc
commit 6b88213644

View File

@ -2090,21 +2090,17 @@ QList<int> Calculator::GetPriceSteps(Configuration * /*cfg*/) const {
return QList<int>();
}
QList<int> Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex) const {
qCritical() << "(" << __func__ << ":" << __LINE__ << ")" << cfg << "paymentOptionIndex:" << paymentOptionIndex;
QList<int> &Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex) const {
qCritical() << "(" << __func__ << ":" << __LINE__ << ") paymentOptionIndex:" << paymentOptionIndex;
if (m_timeSteps.size() > paymentOptionIndex) {
qCritical() << __func__ << ":" << __LINE__ << ")" << "timeSteps:" << m_timeSteps[m_timeSteps.size() - 1];
qCritical() << __func__ << ":" << __LINE__ << ")" << "timeSteps:" << m_timeSteps;
qCritical() << __func__ << ":" << __LINE__ << ")" << "timeSteps size:" << m_timeSteps.size();
return m_timeSteps[m_timeSteps.size() - 1];
if (!m_timeSteps[paymentOptionIndex].isEmpty()) {
return m_timeSteps[paymentOptionIndex];
}
} else {
m_timeSteps.push_back(QList<int>());
qCritical() << __func__ << ":" << __LINE__ << ")" << "timeSteps:" << m_timeSteps;
}
qCritical() << "(" << __func__ << ":" << __LINE__ << ")" << "m_timeSteps:" << m_timeSteps;
QDateTime start = QDateTime::currentDateTime();
start.setTime(QTime(start.time().hour(), start.time().minute(), 0));
@ -2128,8 +2124,6 @@ QList<int> Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex)
m_timeSteps[paymentOptionIndex].append(step);
}
} else {
qCritical() << "(" << __func__ << ":" << __LINE__ << ")";
uint16_t timeStepCompensation = 0;
if (pop_carry_over) {
@ -2207,7 +2201,7 @@ QList<int> Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex)
}
}
qCritical() << "(" << __func__ << ":" << __LINE__ << ")" << "NEW timeSteps:" << m_timeSteps;
qCritical() << "(" << __func__ << ":" << __LINE__ << ") NEW timeSteps:" << m_timeSteps;
return m_timeSteps[paymentOptionIndex];
}