Merge branch 'kleipeda-experimental' of /home/siegert/atbfs01entwicklung/Elektronik/PTU/git_bare_repos/libmobilisis-calc into kleipeda-experimental
This commit is contained in:
		@@ -145,6 +145,14 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg,
 | 
				
			|||||||
    qCritical() << DBG_HEADER << "     time steps:" << tsteps;
 | 
					    qCritical() << DBG_HEADER << "     time steps:" << tsteps;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (paymentMethodId == PaymentMethod::Degressive) {
 | 
					    if (paymentMethodId == PaymentMethod::Degressive) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (static_cast<int>(cost) < cfg->getPaymentOptions(paymentOptionIndex).pop_min_price) {
 | 
				
			||||||
 | 
					            // minimal price is set by GetTimeSteps()
 | 
				
			||||||
 | 
					            qCritical() << DBG_HEADER << "   provided price (cost):" << cost;
 | 
				
			||||||
 | 
					            qCritical() << DBG_HEADER << "configured minimal price:" << cfg->getPaymentOptions(paymentOptionIndex).pop_min_price;
 | 
				
			||||||
 | 
					            return CalcState::BELOW_MIN_PARKING_PRICE.toStdString();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (prepaid == false) {
 | 
					        if (prepaid == false) {
 | 
				
			||||||
            int const pop_id = cfg->getPaymentOptions(paymentOptionIndex).pop_id;
 | 
					            int const pop_id = cfg->getPaymentOptions(paymentOptionIndex).pop_id;
 | 
				
			||||||
            int const pop_accumulate_prices = cfg->getPaymentOptions(paymentOptionIndex).pop_accumulate_prices;
 | 
					            int const pop_accumulate_prices = cfg->getPaymentOptions(paymentOptionIndex).pop_accumulate_prices;
 | 
				
			||||||
@@ -193,23 +201,29 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg,
 | 
				
			|||||||
                            //found = true;
 | 
					                            //found = true;
 | 
				
			||||||
                            //qCritical() << "(" << __func__ << ":" << __LINE__ << ") duration_previous" << duration_previous;
 | 
					                            //qCritical() << "(" << __func__ << ":" << __LINE__ << ") duration_previous" << duration_previous;
 | 
				
			||||||
                            //qCritical() << "(" << __func__ << ":" << __LINE__ << ") duration in minutes" << durationInMinutes;
 | 
					                            //qCritical() << "(" << __func__ << ":" << __LINE__ << ") duration in minutes" << durationInMinutes;
 | 
				
			||||||
                            QString s = inputDate.toString(Qt::ISODate);
 | 
					                            QDateTime d(inputDate.addSecs(duration_previous * 60));
 | 
				
			||||||
                            QDateTime d(QDateTime::fromString(s, Qt::ISODate));
 | 
					
 | 
				
			||||||
                            d = d.addSecs(duration_previous * 60);
 | 
					                            qCritical() << DBG_HEADER << "                    provided price (cost):" << cost;
 | 
				
			||||||
                            //qCritical() << DBG_HEADER << "XXXX" << d;
 | 
					                            qCritical() << DBG_HEADER << "        computed time for price (minutes):" << duration_previous;
 | 
				
			||||||
 | 
					                            qCritical() << DBG_HEADER << "configured minimal parking time (minutes):" << cfg->getPaymentOptions(paymentOptionIndex).pop_min_time;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                            if (duration_previous < cfg->getPaymentOptions(paymentOptionIndex).pop_min_time) {
 | 
				
			||||||
 | 
					                                return CalcState::BELOW_MIN_PARKING_TIME.toStdString(); // minimal parking time is set by GetTimeSteps()
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
                            return d.toString(Qt::ISODate).toStdString();
 | 
					                            return d.toString(Qt::ISODate).toStdString();
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    if ((double)price == cost) {
 | 
					                    if ((double)price == cost) {
 | 
				
			||||||
                        //qCritical() << DBG_HEADER << "price" << price << "cost" << cost;
 | 
					                        QDateTime d(inputDate.addSecs(durationInMinutes * 60));
 | 
				
			||||||
                        //qCritical() << DBG_HEADER << "duration in minutes" << durationInMinutes;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        QString s = inputDate.toString(Qt::ISODate);
 | 
					                        QString const durationStr(d.toString(Qt::ISODate));
 | 
				
			||||||
                        QDateTime d(QDateTime::fromString(s, Qt::ISODate));
 | 
					
 | 
				
			||||||
                        d = d.addSecs(durationInMinutes * 60);
 | 
					                        qCritical() << DBG_HEADER << "     duration in minutes:" << durationInMinutes;
 | 
				
			||||||
                        //qCritical() << DBG_HEADER << "YYYY" << d;
 | 
					                        qCritical() << DBG_HEADER << "   provided price (cost):" << cost;
 | 
				
			||||||
                        return d.toString(Qt::ISODate).toStdString();
 | 
					                        qCritical() << DBG_HEADER << "      duration for price:" << durationStr;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                        return durationStr.toStdString();
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user