Compare commits

..

No commits in common. "5598b028164b8ff27002dd1a6ed5d04f7f26fcec" and "b9a7c04db9ed77365e3a3a1e45c19dbf5f17e60a" have entirely different histories.

2 changed files with 9 additions and 26 deletions

View File

@ -2,7 +2,7 @@ TEMPLATE = lib
TARGET = mobilisis_calc TARGET = mobilisis_calc
#CONFIG += staticlib #CONFIG += staticlib
QMAKE_CXXFLAGS += -std=c++17 -g -O QMAKE_CXXFLAGS += -std=c++17 -g -O0
INCLUDEPATH += $$_PRO_FILE_PWD_/include INCLUDEPATH += $$_PRO_FILE_PWD_/include
INCLUDEPATH += $$_PRO_FILE_PWD_/include/mobilisis INCLUDEPATH += $$_PRO_FILE_PWD_/include/mobilisis

View File

@ -97,31 +97,11 @@ void CALCULATE_LIBRARY_API free_tariff(parking_tariff_t *tariff) {
// UpDown 1 -> up; 0 -> down // UpDown 1 -> up; 0 -> down
int CALCULATE_LIBRARY_API compute_next_timestep(parking_tariff_t *tariff, int currentTimeMinutes, int UpDown) int CALCULATE_LIBRARY_API compute_next_timestep(parking_tariff_t *tariff, int currentTimeMinutes, int UpDown)
{ {
Configuration const *cfg = tariff;
// compute payment method id (e.g. Linear=3, Steps=4)
PaymentMethod const paymentMethodId = Utilities::getPaymentMethodId(cfg);
switch (paymentMethodId) {
case PaymentMethod::Progressive:
qCritical() << " compute_next_timestep() paymentMethodId: Progressive";
break;
case PaymentMethod::Degressive:
qCritical() << " compute_next_timestep() paymentMethodId: Degressive";
break;
case PaymentMethod::Linear:
qCritical() << " compute_next_timestep() paymentMethodId: Linear";
break;
case PaymentMethod::Steps:
qCritical() << " compute_next_timestep() paymentMethodId: Steps";
break;
case PaymentMethod::Undefined:
qCritical() << " compute_next_timestep() paymentMethodId: Undefined";
break;
}
// use tariff with structure as for instance Schnau, Koenigsee: // use tariff with structure as for instance Schnau, Koenigsee:
// without given YearPeriod, SpecialDays and SpecialDaysWorktime // without given YearPeriod, SpecialDays and SpecialDaysWorktime
if (paymentMethodId == PaymentMethod::Steps) if (tariff->YearPeriod.size() == 0
&& tariff->SpecialDays.size() == 0
&& tariff->SpecialDaysWorktime.size() == 0)
{ {
static const QList<int> stepList = calculator.GetTimeSteps(tariff); static const QList<int> stepList = calculator.GetTimeSteps(tariff);
@ -150,8 +130,8 @@ int CALCULATE_LIBRARY_API compute_next_timestep(parking_tariff_t *tariff, int cu
return stepList[currentStepIndex - 1]; return stepList[currentStepIndex - 1];
} }
} }
} else } else {
if (paymentMethodId == PaymentMethod::Linear) { Configuration const *cfg = tariff;
// currentTimeMinutes is the number of minutes actually used. This // currentTimeMinutes is the number of minutes actually used. This
// value is an offset from the start time and cannot be used as a // value is an offset from the start time and cannot be used as a
@ -159,6 +139,9 @@ int CALCULATE_LIBRARY_API compute_next_timestep(parking_tariff_t *tariff, int cu
qCritical() << "compute_next_timestep() currentTimeMinutes:" << currentTimeMinutes; qCritical() << "compute_next_timestep() currentTimeMinutes:" << currentTimeMinutes;
// compute payment method id (e.g. Linear=3, Steps=4)
PaymentMethod paymentMethodId = Utilities::getPaymentMethodId(cfg);
qCritical() << " compute_next_timestep() paymentMethodId:" << paymentMethodId;
// get minimal and maximal parking times // get minimal and maximal parking times
int const minParkingTime = Utilities::getMinimalParkingTime(cfg, paymentMethodId); int const minParkingTime = Utilities::getMinimalParkingTime(cfg, paymentMethodId);