GetTimeSteps(): return step-list as reference; return only a non-empty step-list.
This commit is contained in:
		@@ -2090,21 +2090,17 @@ QList<int> Calculator::GetPriceSteps(Configuration * /*cfg*/) const {
 | 
				
			|||||||
    return QList<int>();
 | 
					    return QList<int>();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
QList<int> Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex) const {
 | 
					QList<int> &Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex) const {
 | 
				
			||||||
    qCritical() << "(" << __func__ << ":" << __LINE__ << ")" << cfg << "paymentOptionIndex:" << paymentOptionIndex;
 | 
					    qCritical() << "(" << __func__ << ":" << __LINE__ << ")              paymentOptionIndex:" << paymentOptionIndex;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (m_timeSteps.size() > paymentOptionIndex) {
 | 
					    if (m_timeSteps.size() > paymentOptionIndex) {
 | 
				
			||||||
        qCritical() << __func__ << ":" << __LINE__ << ")" << "timeSteps:" << m_timeSteps[m_timeSteps.size() - 1];
 | 
					        if (!m_timeSteps[paymentOptionIndex].isEmpty()) {
 | 
				
			||||||
        qCritical() << __func__ << ":" << __LINE__ << ")" << "timeSteps:" << m_timeSteps;
 | 
					            return m_timeSteps[paymentOptionIndex];
 | 
				
			||||||
        qCritical() << __func__ << ":" << __LINE__ << ")" << "timeSteps size:" << m_timeSteps.size();
 | 
					        }
 | 
				
			||||||
        return m_timeSteps[m_timeSteps.size() - 1];
 | 
					 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        m_timeSteps.push_back(QList<int>());
 | 
					        m_timeSteps.push_back(QList<int>());
 | 
				
			||||||
        qCritical() << __func__ << ":" << __LINE__ << ")" << "timeSteps:" << m_timeSteps;
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    qCritical() << "(" << __func__ << ":" << __LINE__ << ")" << "m_timeSteps:" << m_timeSteps;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    QDateTime start = QDateTime::currentDateTime();
 | 
					    QDateTime start = QDateTime::currentDateTime();
 | 
				
			||||||
    start.setTime(QTime(start.time().hour(), start.time().minute(), 0));
 | 
					    start.setTime(QTime(start.time().hour(), start.time().minute(), 0));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -2114,9 +2110,9 @@ QList<int> Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    static PaymentMethod const paymentMethodId = Utilities::getPaymentMethodId(cfg);
 | 
					    static PaymentMethod const paymentMethodId = Utilities::getPaymentMethodId(cfg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    qCritical() << "(" << __func__ << ":" << __LINE__ << ")        start parking time:" << start.toString(Qt::ISODate);
 | 
					    qCritical() << "(" << __func__ << ":" << __LINE__ << ")              start parking time:" << start.toString(Qt::ISODate);
 | 
				
			||||||
    qCritical() << "(" << __func__ << ":" << __LINE__ << ")         payment option id:" << pop_id;
 | 
					    qCritical() << "(" << __func__ << ":" << __LINE__ << ")               payment option id:" << pop_id;
 | 
				
			||||||
    qCritical() << "(" << __func__ << ":" << __LINE__ << ") payment option carry over:" << pop_carry_over;
 | 
					    qCritical() << "(" << __func__ << ":" << __LINE__ << ")       payment option carry over:" << pop_carry_over;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (pop_time_step_config == (int)ATBTimeStepConfig::TimeStepConfig::DYNAMIC) {
 | 
					    if (pop_time_step_config == (int)ATBTimeStepConfig::TimeStepConfig::DYNAMIC) {
 | 
				
			||||||
        //qCritical() << __PRETTY_FUNCTION__ << "payment option time step config:" << "TimeStepConfig::DYNAMIC";
 | 
					        //qCritical() << __PRETTY_FUNCTION__ << "payment option time step config:" << "TimeStepConfig::DYNAMIC";
 | 
				
			||||||
@@ -2128,8 +2124,6 @@ QList<int> Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex)
 | 
				
			|||||||
                m_timeSteps[paymentOptionIndex].append(step);
 | 
					                m_timeSteps[paymentOptionIndex].append(step);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            qCritical() << "(" << __func__ << ":" << __LINE__ << ")";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            uint16_t timeStepCompensation = 0;
 | 
					            uint16_t timeStepCompensation = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (pop_carry_over) {
 | 
					            if (pop_carry_over) {
 | 
				
			||||||
@@ -2162,7 +2156,7 @@ QList<int> Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex)
 | 
				
			|||||||
                                    // set dynamic minimal parking time
 | 
					                                    // set dynamic minimal parking time
 | 
				
			||||||
                                    cfg->getPaymentOptions(paymentOptionIndex).pop_min_time = timeStep;
 | 
					                                    cfg->getPaymentOptions(paymentOptionIndex).pop_min_time = timeStep;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                                    qCritical() << "(" << __func__ << ":" << __LINE__ << ") computed minimal parking time:" << cfg->getPaymentOptions(paymentOptionIndex).pop_min_time;
 | 
					                                    qCritical() << "(" << __func__ << ":" << __LINE__ << ")   computed minimal parking time:" << cfg->getPaymentOptions(paymentOptionIndex).pop_min_time;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                                    duration.pun_duration = timeStep;
 | 
					                                    duration.pun_duration = timeStep;
 | 
				
			||||||
                                    timeStepCompensation = duration.pun_duration_max - duration.pun_duration;
 | 
					                                    timeStepCompensation = duration.pun_duration_max - duration.pun_duration;
 | 
				
			||||||
@@ -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];
 | 
					    return m_timeSteps[paymentOptionIndex];
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user