add files for fix
This commit is contained in:
		@@ -115,7 +115,7 @@ public:
 | 
			
		||||
    uint32_t GetCostFromDuration(Configuration *cfg, QDateTime const &start, quint64 durationMinutes, int paymentOptionIndex=0) const;
 | 
			
		||||
    uint32_t GetCostFromDuration(Configuration *cfg, QDateTime const &start, QDateTime const &end, int paymentOptionIndex=0) const;
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
// private:
 | 
			
		||||
    Ticket private_GetCostFromDuration(Configuration const* cfg,
 | 
			
		||||
                                       QDateTime const &start,
 | 
			
		||||
                                       int durationMinutes,
 | 
			
		||||
 
 | 
			
		||||
@@ -28,6 +28,10 @@ public:
 | 
			
		||||
        pop_carry_over_time_range_id = -1;
 | 
			
		||||
        pop_carry_over_start_time_range = -1;
 | 
			
		||||
        pop_carry_over_end_time_range = -1;
 | 
			
		||||
        pop_prepay = false;
 | 
			
		||||
        pop_prepay_time_range_id = -1;
 | 
			
		||||
        pop_prepay_over_start_time_range = -1;
 | 
			
		||||
        pop_prepay_end_time_range = -1;
 | 
			
		||||
        pop_daily_card_price = -1;
 | 
			
		||||
        pop_business_hours = -1;
 | 
			
		||||
        pop_time_step_config = -1;
 | 
			
		||||
@@ -48,6 +52,10 @@ public:
 | 
			
		||||
    int pop_carry_over_time_range_id;
 | 
			
		||||
    int pop_carry_over_start_time_range;
 | 
			
		||||
    int pop_carry_over_end_time_range;
 | 
			
		||||
    bool pop_prepay;
 | 
			
		||||
    int pop_prepay_time_range_id;
 | 
			
		||||
    int pop_prepay_over_start_time_range;
 | 
			
		||||
    int pop_prepay_end_time_range;
 | 
			
		||||
    int pop_daily_card_price;
 | 
			
		||||
    uint64_t pop_business_hours;
 | 
			
		||||
    int pop_time_step_config;
 | 
			
		||||
 
 | 
			
		||||
@@ -344,7 +344,7 @@ int CALCULATE_LIBRARY_API compute_next_timestep(parking_tariff_t *tariff, int cu
 | 
			
		||||
    qCritical() << "   compute_next_timestep()     currentTimeMinutes: " << currentTimeMinutes;
 | 
			
		||||
    qCritical() << "   compute_next_timestep() up/down (1=up, 0=down): " << UpDown;
 | 
			
		||||
 | 
			
		||||
    Configuration const *cfg = tariff;
 | 
			
		||||
    Configuration *cfg = tariff;
 | 
			
		||||
 | 
			
		||||
    // compute payment method id (e.g. Linear=3, Steps=4)
 | 
			
		||||
    PaymentMethod const paymentMethodId = Utilities::getPaymentMethodId(cfg);
 | 
			
		||||
@@ -372,16 +372,71 @@ int CALCULATE_LIBRARY_API compute_next_timestep(parking_tariff_t *tariff, int cu
 | 
			
		||||
        // progressive tariff: e.g. Neuhauser, Kirchdorf (743)
 | 
			
		||||
        (paymentMethodId == PaymentMethod::Progressive))
 | 
			
		||||
    {
 | 
			
		||||
        const QList<int> stepList = Calculator::GetInstance().GetTimeSteps(tariff);
 | 
			
		||||
        QVector<QList<int>> stepListVec;
 | 
			
		||||
        QList<int> const timeSteps = Calculator::GetInstance().GetTimeSteps(tariff);
 | 
			
		||||
 | 
			
		||||
        qCritical() << "   compute_next_timestep() time-steps: " << timeSteps;
 | 
			
		||||
 | 
			
		||||
        int paymentOptionIndex = 0;
 | 
			
		||||
        int const pop_time_step_config = tariff->getPaymentOptions(paymentOptionIndex).pop_time_step_config;
 | 
			
		||||
 | 
			
		||||
        if (pop_time_step_config == (int)ATBTimeStepConfig::TimeStepConfig::DYNAMIC) {
 | 
			
		||||
            QList<int> lst;
 | 
			
		||||
            for (int index = 0; index < 5; ++index) {
 | 
			
		||||
                lst.clear();
 | 
			
		||||
                QListIterator<int> i(timeSteps);
 | 
			
		||||
                while (i.hasNext()) {
 | 
			
		||||
                    switch (index) {
 | 
			
		||||
                    case 0:
 | 
			
		||||
                        lst.append(i.next());
 | 
			
		||||
                    break;
 | 
			
		||||
                    case 1:
 | 
			
		||||
                        lst.append(i.next() - 2);
 | 
			
		||||
                    break;
 | 
			
		||||
                    case 2:
 | 
			
		||||
                        lst.append(i.next() - 1);
 | 
			
		||||
                    break;
 | 
			
		||||
                    case 3:
 | 
			
		||||
                        lst.append(i.next() + 1);
 | 
			
		||||
                    break;
 | 
			
		||||
                    case 4:
 | 
			
		||||
                        lst.append(i.next() + 2);
 | 
			
		||||
                    break;
 | 
			
		||||
                    default:;
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                qCritical() << "   compute_next_timestep() " << index << "list of time-steps" << lst;
 | 
			
		||||
                stepListVec.append(lst);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        int stepListIndex = -1;
 | 
			
		||||
 | 
			
		||||
        for (int index = 0; index < stepListVec.size(); ++index) {
 | 
			
		||||
            if (stepListVec[index].indexOf(currentTimeMinutes) != -1) {
 | 
			
		||||
                stepListIndex = index;
 | 
			
		||||
                break;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (stepListIndex == -1) {
 | 
			
		||||
            qCritical() << "compute_next_timestep() *NO STEP INDEX* for currentTimeMinutes (" << currentTimeMinutes << ")";
 | 
			
		||||
            return  currentTimeMinutes;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        QList<int> const &stepList = stepListVec[stepListIndex];
 | 
			
		||||
        qCritical() << "   compute_next_timestep()         index:" << stepListIndex;
 | 
			
		||||
        qCritical() << "   compute_next_timestep()     timeSteps:" << stepList;
 | 
			
		||||
 | 
			
		||||
        int currentStepIndex = stepList.indexOf(currentTimeMinutes);
 | 
			
		||||
        int const currentStepIndex = stepList.indexOf(currentTimeMinutes); // must be currentStepIndex != -1
 | 
			
		||||
 | 
			
		||||
        if (currentStepIndex == -1) {
 | 
			
		||||
            qCritical() << "compute_next_timestep() *NO STEP* for currentTimeMinutes (" << currentTimeMinutes << ")";
 | 
			
		||||
            return  currentTimeMinutes;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        cfg->getPaymentOptions(paymentOptionIndex).pop_min_time = stepList.first();
 | 
			
		||||
 | 
			
		||||
        if (UpDown == 1) { // UP
 | 
			
		||||
            if (stepList[currentStepIndex] == stepList.last()) {
 | 
			
		||||
                qCritical() << "compute_next_timestep() *NO NEXT STEP* for currentTimeMinutes (" << currentTimeMinutes << ")";
 | 
			
		||||
 
 | 
			
		||||
@@ -2091,15 +2091,20 @@ QList<int> Calculator::GetPriceSteps(Configuration * /*cfg*/) const {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QList<int> Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex) const {
 | 
			
		||||
    qCritical() << "(" << __func__ << ":" << __LINE__ << ")" << "paymentOptionIndex:" << paymentOptionIndex;
 | 
			
		||||
    qCritical() << "(" << __func__ << ":" << __LINE__ << ")" << cfg << "paymentOptionIndex:" << paymentOptionIndex;
 | 
			
		||||
 | 
			
		||||
    if (m_timeSteps.size() > paymentOptionIndex) {
 | 
			
		||||
        //qCritical() << __PRETTY_FUNCTION__ << "timeSteps:" << m_timeSteps;
 | 
			
		||||
        return m_timeSteps[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];
 | 
			
		||||
    } 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));
 | 
			
		||||
 | 
			
		||||
@@ -2123,6 +2128,8 @@ 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) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user