Compare commits
19 Commits
Author | SHA1 | Date | |
---|---|---|---|
a3983ed427 | |||
f8805e9e78 | |||
7a6360f392 | |||
08a249f393 | |||
7c173ae292 | |||
80637260f3 | |||
9b524d63e5 | |||
25b3143d88
|
|||
0856f10ca9 | |||
88c703ecc2
|
|||
465b2274a1 | |||
f946cd13e4
|
|||
62c52fd580 | |||
1023f6ede1 | |||
36b3e85d1b | |||
b394ed46cc | |||
3dda2d8355 | |||
1152c3824e | |||
4271c0fb31 |
@@ -42,6 +42,7 @@ public:
|
|||||||
pop_use_only_for_duration = 0; // deprecated
|
pop_use_only_for_duration = 0; // deprecated
|
||||||
pop_plus_steps = 1; // +: jump <x=1> steps forward
|
pop_plus_steps = 1; // +: jump <x=1> steps forward
|
||||||
pop_minus_steps = 1; // -: jump <x=1> steps backward
|
pop_minus_steps = 1; // -: jump <x=1> steps backward
|
||||||
|
pop_allow_overpay = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pop_id;
|
int pop_id;
|
||||||
@@ -73,6 +74,7 @@ public:
|
|||||||
bool pop_accumulate_durations;
|
bool pop_accumulate_durations;
|
||||||
int pop_plus_steps;
|
int pop_plus_steps;
|
||||||
int pop_minus_steps;
|
int pop_minus_steps;
|
||||||
|
bool pop_allow_overpay;
|
||||||
|
|
||||||
struct ATBMaxDateTime {
|
struct ATBMaxDateTime {
|
||||||
int direction;
|
int direction;
|
||||||
|
@@ -508,10 +508,12 @@ int CALCULATE_LIBRARY_API compute_next_timestep(parking_tariff_t *tariff, int cu
|
|||||||
// without given YearPeriod, SpecialDays and SpecialDaysWorktime
|
// without given YearPeriod, SpecialDays and SpecialDaysWorktime
|
||||||
if ((paymentMethodId == PaymentMethod::Steps) ||
|
if ((paymentMethodId == PaymentMethod::Steps) ||
|
||||||
// progressive tariff: e.g. Neuhauser, Kirchdorf (743)
|
// progressive tariff: e.g. Neuhauser, Kirchdorf (743)
|
||||||
(paymentMethodId == PaymentMethod::Progressive))
|
(paymentMethodId == PaymentMethod::Progressive) ||
|
||||||
// (paymentMethodId == PaymentMethod::Degressive)) degressive tariff: e.g. Fuchs Technik (500)
|
// degressive tariff: e.g. Fuchs Technik (500)
|
||||||
|
(paymentMethodId == PaymentMethod::Degressive))
|
||||||
{
|
{
|
||||||
QList<int> &stepList = Calculator::GetInstance().GetTimeSteps(tariff, paymentOptionIndex);
|
QList<int> &stepList = Calculator::GetInstance().GetTimeSteps(tariff, paymentOptionIndex);
|
||||||
|
|
||||||
int const size = stepList.size();
|
int const size = stepList.size();
|
||||||
if (size == 0) {
|
if (size == 0) {
|
||||||
qCritical() << "compute_next_timestep() *ERROR empty step-list*";
|
qCritical() << "compute_next_timestep() *ERROR empty step-list*";
|
||||||
@@ -769,17 +771,19 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket(
|
|||||||
QList<int> tlist = Calculator::GetInstance().GetTimeSteps(tariff);
|
QList<int> tlist = Calculator::GetInstance().GetTimeSteps(tariff);
|
||||||
Q_UNUSED(tlist);
|
Q_UNUSED(tlist);
|
||||||
|
|
||||||
|
// compute cost (price)
|
||||||
cost = Calculator::GetInstance().GetCostFromDuration(tariff, start_parking_time, netto_parking_time, paymentOptionIndex);
|
cost = Calculator::GetInstance().GetCostFromDuration(tariff, start_parking_time, netto_parking_time, paymentOptionIndex);
|
||||||
|
|
||||||
int weekDay = start_parking_time.date().dayOfWeek();
|
int weekDay = start_parking_time.date().dayOfWeek();
|
||||||
int pop_carry_over_option_id = tariff->getPaymentOptions(paymentOptionIndex).pop_carry_over_option_id;
|
int pop_carry_over_option_id = tariff->getPaymentOptions(paymentOptionIndex).pop_carry_over_option_id;
|
||||||
|
qCritical() << __func__ << __LINE__ << "configured carry-over-id" << pop_carry_over_option_id;
|
||||||
|
|
||||||
std::optional<ATBPeriodYear> yperiod = Utilities::GetYearPeriodActive(tariff, start_parking_time);
|
std::optional<ATBPeriodYear> yperiod = Utilities::GetYearPeriodActive(tariff, start_parking_time);
|
||||||
if (yperiod.has_value()) {
|
if (yperiod.has_value()) {
|
||||||
ATBPeriodYear const &period = yperiod.value();
|
ATBPeriodYear const &period = yperiod.value();
|
||||||
pop_carry_over_option_id = period.pye_id;
|
pop_carry_over_option_id = period.pye_id;
|
||||||
|
qCritical() << __func__ << __LINE__ << "re-computed carry-over-id" << pop_carry_over_option_id;
|
||||||
}
|
}
|
||||||
qCritical() << __func__ << __LINE__ << "carryOver-id" << pop_carry_over_option_id;
|
|
||||||
|
|
||||||
QTime const carryOverStart = tariff->TariffCarryOverOptions.find(pop_carry_over_option_id)->second.carryover[weekDay].static_start;
|
QTime const carryOverStart = tariff->TariffCarryOverOptions.find(pop_carry_over_option_id)->second.carryover[weekDay].static_start;
|
||||||
int const carryOverDuration = tariff->TariffCarryOverOptions.find(pop_carry_over_option_id)->second.carryover[weekDay].duration;
|
int const carryOverDuration = tariff->TariffCarryOverOptions.find(pop_carry_over_option_id)->second.carryover[weekDay].duration;
|
||||||
@@ -793,6 +797,9 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket(
|
|||||||
std::optional<ATBPrepaid> prepaidOption = tariff->getPrepaidType(prepaid_option_id);
|
std::optional<ATBPrepaid> prepaidOption = tariff->getPrepaidType(prepaid_option_id);
|
||||||
if (prepaidOption.has_value()) {
|
if (prepaidOption.has_value()) {
|
||||||
ATBPrepaid const &p = prepaidOption.value();
|
ATBPrepaid const &p = prepaidOption.value();
|
||||||
|
if (p.never) {
|
||||||
|
qCritical() << __func__ << __LINE__ << "prepaid: no";
|
||||||
|
} else {
|
||||||
if (start_parking_time.time() < p.static_end) { // static_end: e.g. 08:00:00
|
if (start_parking_time.time() < p.static_end) { // static_end: e.g. 08:00:00
|
||||||
effectiveStartTime.setTime(p.static_end);
|
effectiveStartTime.setTime(p.static_end);
|
||||||
} else
|
} else
|
||||||
@@ -800,6 +807,7 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket(
|
|||||||
effectiveStartTime.setTime(p.static_start);
|
effectiveStartTime.setTime(p.static_start);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// handle carry over
|
// handle carry over
|
||||||
int minutesUntilCarryOver = effectiveStartTime.time().secsTo(carryOverStart) / 60;
|
int minutesUntilCarryOver = effectiveStartTime.time().secsTo(carryOverStart) / 60;
|
||||||
@@ -841,6 +849,12 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket(
|
|||||||
return calcState.set(CalcState::State::INVALID_START_DATE);
|
return calcState.set(CalcState::State::INVALID_START_DATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (end_parking_time.time().hour() == 0 && end_parking_time.time().minute() == 0) {
|
||||||
|
end_parking_time = end_parking_time.addDays(-1);
|
||||||
|
end_parking_time.setTime(QTime(23, 59, 0));
|
||||||
|
}
|
||||||
|
qCritical() << __func__ << __LINE__ << "end_parking_time" << end_parking_time.toString(Qt::ISODate);
|
||||||
|
|
||||||
return calcState.set(CalcState::State::SUCCESS);
|
return calcState.set(CalcState::State::SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -901,6 +915,7 @@ CalcState CALCULATE_LIBRARY_API compute_duration_for_parking_ticket(
|
|||||||
bool prepaid = true;
|
bool prepaid = true;
|
||||||
int paymentOptionIndex = tariff->getPaymentOptionIndex(permitType);
|
int paymentOptionIndex = tariff->getPaymentOptionIndex(permitType);
|
||||||
int prepaid_option_id = tariff->getPaymentOptions(paymentOptionIndex).pop_prepaid_option_id;
|
int prepaid_option_id = tariff->getPaymentOptions(paymentOptionIndex).pop_prepaid_option_id;
|
||||||
|
|
||||||
if (prepaid_option_id == 2) {
|
if (prepaid_option_id == 2) {
|
||||||
prepaid = false;
|
prepaid = false;
|
||||||
}
|
}
|
||||||
@@ -915,6 +930,28 @@ CalcState CALCULATE_LIBRARY_API compute_duration_for_parking_ticket(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (start_parking_time.isValid()) {
|
if (start_parking_time.isValid()) {
|
||||||
|
|
||||||
|
int const pop_time_step_config = tariff->getPaymentOptions(paymentOptionIndex).pop_time_step_config;
|
||||||
|
if (pop_time_step_config == (int)ATBTimeStepConfig::TimeStepConfig::STATIC) {
|
||||||
|
// handle prepaid option
|
||||||
|
QDateTime effectiveStartTime(start_parking_time);
|
||||||
|
int const prepaid_option_id = tariff->getPaymentOptions(paymentOptionIndex).pop_prepaid_option_id;
|
||||||
|
std::optional<ATBPrepaid> prepaidOption = tariff->getPrepaidType(prepaid_option_id);
|
||||||
|
if (prepaidOption.has_value()) {
|
||||||
|
ATBPrepaid const &p = prepaidOption.value();
|
||||||
|
if (p.never) {
|
||||||
|
qCritical() << __func__ << __LINE__ << "prepaid: no";
|
||||||
|
} else {
|
||||||
|
if (start_parking_time.time() < p.static_end) { // static_end: e.g. 08:00:00
|
||||||
|
effectiveStartTime.setTime(p.static_end);
|
||||||
|
} else
|
||||||
|
if (start_parking_time.time() > p.static_start) { // static_start: e.g. 22:00:00
|
||||||
|
effectiveStartTime.setTime(p.static_start);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QString cs = start_parking_time.toString(Qt::ISODate);
|
QString cs = start_parking_time.toString(Qt::ISODate);
|
||||||
QString endTime = Calculator::GetInstance().GetDurationFromCost(
|
QString endTime = Calculator::GetInstance().GetDurationFromCost(
|
||||||
tariff,
|
tariff,
|
||||||
@@ -982,15 +1019,70 @@ CalcState CALCULATE_LIBRARY_API compute_duration_for_parking_ticket(
|
|||||||
} else {
|
} else {
|
||||||
ticketEndTime = QDateTime::fromString(endTime,Qt::ISODate);
|
ticketEndTime = QDateTime::fromString(endTime,Qt::ISODate);
|
||||||
|
|
||||||
// DEBUG
|
|
||||||
//qCritical() << "compute_duration_for_parking_ticket(): ";
|
|
||||||
//qCritical() << " endTime: " << endTime;
|
|
||||||
//qCritical() << " ticketEndTime: " << ticketEndTime;
|
|
||||||
|
|
||||||
if (!ticketEndTime.isValid()) {
|
if (!ticketEndTime.isValid()) {
|
||||||
calcState.setDesc(QString("ticketEndTime=%1").arg(endTime));
|
calcState.setDesc(QString("ticketEndTime=%1").arg(endTime));
|
||||||
return calcState.set(CalcState::State::WRONG_ISO_TIME_FORMAT);
|
return calcState.set(CalcState::State::WRONG_ISO_TIME_FORMAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pop_time_step_config == (int)ATBTimeStepConfig::TimeStepConfig::STATIC) {
|
||||||
|
// handle carry over for ticket-end-time
|
||||||
|
qCritical() << __func__ << ":" << __LINE__ << "ticketEndTime:" << ticketEndTime.toString(Qt::ISODate);
|
||||||
|
|
||||||
|
int weekDay = start_parking_time.date().dayOfWeek();
|
||||||
|
int pop_carry_over_option_id = tariff->getPaymentOptions(paymentOptionIndex).pop_carry_over_option_id;
|
||||||
|
qCritical() << __func__ << __LINE__ << "configured carry-over-id" << pop_carry_over_option_id;
|
||||||
|
|
||||||
|
std::optional<ATBPeriodYear> yperiod = Utilities::GetYearPeriodActive(tariff, start_parking_time);
|
||||||
|
if (yperiod.has_value()) {
|
||||||
|
ATBPeriodYear const &period = yperiod.value();
|
||||||
|
pop_carry_over_option_id = period.pye_id;
|
||||||
|
qCritical() << __func__ << __LINE__ << "re-computed carry-over-id" << pop_carry_over_option_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
QTime carryOverStart;
|
||||||
|
QTime carryOverEnd;
|
||||||
|
int carryOverDuration = -1;
|
||||||
|
|
||||||
|
// using TariffCarryOverType = std::multimap<int, ATBCarryOver>;
|
||||||
|
std::multimap<int, ATBCarryOver>::const_iterator it;
|
||||||
|
if ((it = tariff->TariffCarryOverOptions.find(pop_carry_over_option_id)) !=
|
||||||
|
tariff->TariffCarryOverOptions.cend()) {
|
||||||
|
carryOverStart = it->second.carryover[weekDay].static_start;
|
||||||
|
carryOverEnd = it->second.carryover[weekDay].static_end;
|
||||||
|
carryOverDuration = it->second.carryover[weekDay].duration;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (carryOverStart.isValid() && carryOverEnd.isValid()) {
|
||||||
|
qCritical() << __func__ << __LINE__ << "carryOverStart" << carryOverStart.toString(Qt::ISODate);
|
||||||
|
qCritical() << __func__ << __LINE__ << "carryOverEnd" << carryOverEnd.toString(Qt::ISODate);
|
||||||
|
qCritical() << __func__ << __LINE__ << "carryOverDuration" << carryOverDuration;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (carryOverStart.isValid() && carryOverEnd.isValid() && carryOverDuration != -1) {
|
||||||
|
qCritical() << __func__ << __LINE__ << "ticketEndTime.time():" << ticketEndTime.time().toString(Qt::ISODate);
|
||||||
|
if (ticketEndTime.time() > carryOverStart) {
|
||||||
|
qCritical() << __func__ << __LINE__ << "ticketEndTime.time():" << ticketEndTime.time().toString(Qt::ISODate);
|
||||||
|
ticketEndTime = ticketEndTime.addSecs(carryOverDuration * 60);
|
||||||
|
} else {
|
||||||
|
qCritical() << __func__ << __LINE__ << "ticketEndTime.time():" << ticketEndTime.time().toString(Qt::ISODate);
|
||||||
|
if (ticketEndTime.time() < carryOverEnd) {
|
||||||
|
qCritical() << __func__ << __LINE__ << "ticketEndTime.time():" << ticketEndTime.time().toString(Qt::ISODate);
|
||||||
|
ticketEndTime = ticketEndTime.addSecs(carryOverDuration * 60);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
qCritical() << __func__ << __LINE__ << "WARNING: wrong carry-over-settings";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ticketEndTime.time().hour() == 0 && ticketEndTime.time().minute() == 0) {
|
||||||
|
ticketEndTime = ticketEndTime.addDays(-1);
|
||||||
|
ticketEndTime.setTime(QTime(23, 59, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
// DEBUG
|
||||||
|
qCritical() << __func__ << __LINE__ << " endTime:" << endTime;
|
||||||
|
qCritical() << __func__ << __LINE__ << "ticketEndTime:" << ticketEndTime;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return calcState.set(CalcState::State::INVALID_START_DATE);
|
return calcState.set(CalcState::State::INVALID_START_DATE);
|
||||||
|
@@ -181,8 +181,8 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg,
|
|||||||
price = pra_price;
|
price = pra_price;
|
||||||
}
|
}
|
||||||
|
|
||||||
//qCritical() << DBG_HEADER << " PRICE" << price << "COST" << cost;
|
// qCritical() << DBG_HEADER << " PRICE" << price << "COST" << cost;
|
||||||
//qCritical() << DBG_HEADER << " duration id" << durationId;
|
// qCritical() << DBG_HEADER << " duration id" << durationId;
|
||||||
|
|
||||||
auto search = cfg->Duration.find(durationId);
|
auto search = cfg->Duration.find(durationId);
|
||||||
if (search != cfg->Duration.end()) {
|
if (search != cfg->Duration.end()) {
|
||||||
@@ -207,11 +207,16 @@ 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;
|
||||||
QDateTime d(inputDate.addSecs(duration_previous * 60));
|
QDateTime d;
|
||||||
|
if (pop_accumulate_durations) {
|
||||||
|
d = inputDate.addSecs(durationInMinutes * 60);
|
||||||
|
} else {
|
||||||
|
d = inputDate.addSecs(duration_previous * 60);
|
||||||
|
}
|
||||||
|
|
||||||
qCritical() << DBG_HEADER << " provided price (cost):" << cost;
|
qCritical() << DBG_HEADER << " provided price (cost):" << cost;
|
||||||
qCritical() << DBG_HEADER << " computed time for price (minutes):" << duration_previous;
|
qCritical() << DBG_HEADER << " computed time for price (minutes):" << duration_previous;
|
||||||
qCritical() << DBG_HEADER << "configured minimal parking time (minutes):" << cfg->getPaymentOptions(paymentOptionIndex).pop_min_time;
|
qCritical() << DBG_HEADER << " minimal parking time (minutes):" << cfg->getPaymentOptions(paymentOptionIndex).pop_min_time;
|
||||||
|
|
||||||
if (duration_previous < 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 CalcState::BELOW_MIN_PARKING_TIME.toStdString(); // minimal parking time is set by GetTimeSteps()
|
||||||
@@ -257,11 +262,15 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg,
|
|||||||
int const pop_id = cfg->getPaymentOptions(paymentOptionIndex).pop_id;
|
int const pop_id = cfg->getPaymentOptions(paymentOptionIndex).pop_id;
|
||||||
int const pop_max_price = cfg->getPaymentOptions(paymentOptionIndex).pop_max_price;
|
int const pop_max_price = cfg->getPaymentOptions(paymentOptionIndex).pop_max_price;
|
||||||
int const pop_min_price = cfg->getPaymentOptions(paymentOptionIndex).pop_min_price;
|
int const pop_min_price = cfg->getPaymentOptions(paymentOptionIndex).pop_min_price;
|
||||||
|
int const pop_allow_overpay = cfg->getPaymentOptions(paymentOptionIndex).pop_allow_overpay;
|
||||||
|
|
||||||
if (cost > pop_max_price) {
|
if (cost > pop_max_price) {
|
||||||
cost = pop_max_price;
|
|
||||||
qCritical() << DBG_HEADER << "MAX-PARKING-PRICE" << pop_max_price << ", COST" << cost;
|
qCritical() << DBG_HEADER << "MAX-PARKING-PRICE" << pop_max_price << ", COST" << cost;
|
||||||
//return CalcState::OVERPAID.toStdString();
|
if (pop_allow_overpay == false) {
|
||||||
|
return CalcState::OVERPAID.toStdString();
|
||||||
|
}
|
||||||
|
cost = pop_max_price;
|
||||||
|
// return CalcState::OVERPAID.toStdString();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cost < pop_min_price) {
|
if (cost < pop_min_price) {
|
||||||
@@ -1018,7 +1027,8 @@ uint32_t Calculator::GetCostFromDuration(Configuration * cfg,
|
|||||||
if (paymentMethodId == PaymentMethod::Steps ||
|
if (paymentMethodId == PaymentMethod::Steps ||
|
||||||
paymentMethodId == PaymentMethod::Degressive) {
|
paymentMethodId == PaymentMethod::Degressive) {
|
||||||
int const timeStepInMinutes = start.secsTo(end) / 60;
|
int const timeStepInMinutes = start.secsTo(end) / 60;
|
||||||
|
QList<int> tlist = Calculator::GetInstance().GetTimeSteps(cfg, paymentOptionIndex, start);
|
||||||
|
qCritical() << DBG_HEADER << "timeStepList" << timeStepInMinutes << tlist;
|
||||||
qCritical() << DBG_HEADER << "timeStepInMinutes" << timeStepInMinutes << start.toString(Qt::ISODate);
|
qCritical() << DBG_HEADER << "timeStepInMinutes" << timeStepInMinutes << start.toString(Qt::ISODate);
|
||||||
|
|
||||||
return GetPriceForTimeStep(cfg, timeStepInMinutes, paymentOptionIndex);
|
return GetPriceForTimeStep(cfg, timeStepInMinutes, paymentOptionIndex);
|
||||||
@@ -2809,11 +2819,13 @@ uint32_t Calculator::GetPriceForTimeStep(Configuration *cfg, int timeStep, int p
|
|||||||
// paymentOptionIndex = 1;
|
// paymentOptionIndex = 1;
|
||||||
|
|
||||||
int const pop_id = cfg->getPaymentOptions(paymentOptionIndex).pop_id;
|
int const pop_id = cfg->getPaymentOptions(paymentOptionIndex).pop_id;
|
||||||
|
int const pop_accumulate_durations = cfg->getPaymentOptions(paymentOptionIndex).pop_accumulate_durations;
|
||||||
int const pop_accumulate_prices = cfg->getPaymentOptions(paymentOptionIndex).pop_accumulate_prices;
|
int const pop_accumulate_prices = cfg->getPaymentOptions(paymentOptionIndex).pop_accumulate_prices;
|
||||||
|
|
||||||
uint32_t price = 0;
|
uint32_t price = 0;
|
||||||
|
int pun_duration = 0;
|
||||||
|
|
||||||
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") paymentOptionIndex" << paymentOptionIndex;
|
qCritical() << "(" << __func__ << ":" << __LINE__ << ") paymentOptionIndex" << paymentOptionIndex;
|
||||||
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") timeStep" << timeStep;
|
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") timeStep" << timeStep;
|
||||||
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") pop_id" << pop_id;
|
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") pop_id" << pop_id;
|
||||||
|
|
||||||
@@ -2827,19 +2839,25 @@ uint32_t Calculator::GetPriceForTimeStep(Configuration *cfg, int timeStep, int p
|
|||||||
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") pun_id" << pun_id;
|
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") pun_id" << pun_id;
|
||||||
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") pun_unit_id" << payment_unit_id;
|
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") pun_unit_id" << payment_unit_id;
|
||||||
|
|
||||||
int const pun_duration = cfg->Duration.find(payment_unit_id)->second.pun_duration;
|
if (pop_accumulate_durations) {
|
||||||
//int const pun_duration = cfg->Duration.find(2)->second.pun_duration;
|
pun_duration += cfg->Duration.find(payment_unit_id)->second.pun_duration;
|
||||||
|
} else {
|
||||||
|
pun_duration = cfg->Duration.find(payment_unit_id)->second.pun_duration;
|
||||||
|
}
|
||||||
|
|
||||||
if (pop_accumulate_prices) {
|
if (pop_accumulate_prices) {
|
||||||
price += itr->second.pra_price;
|
price += itr->second.pra_price;
|
||||||
} else {
|
} else {
|
||||||
price = (uint32_t)(itr->second.pra_price);
|
price = (uint32_t)(itr->second.pra_price);
|
||||||
}
|
}
|
||||||
|
|
||||||
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") price" << price;
|
if (DBG_LEVEL >= DBG_DEBUG) {
|
||||||
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") pun_id" << pun_id;
|
qCritical() << "(" << __func__ << ":" << __LINE__ << ") price" << price;
|
||||||
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") pun_unit_id" << payment_unit_id;
|
qCritical() << "(" << __func__ << ":" << __LINE__ << ") pun_id" << pun_id;
|
||||||
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") pun_duration" << pun_duration;
|
qCritical() << "(" << __func__ << ":" << __LINE__ << ") pun_unit_id" << payment_unit_id;
|
||||||
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") timeStep" << timeStep;
|
qCritical() << "(" << __func__ << ":" << __LINE__ << ") pun_duration" << pun_duration;
|
||||||
|
qCritical() << "(" << __func__ << ":" << __LINE__ << ") timeStep" << timeStep;
|
||||||
|
}
|
||||||
|
|
||||||
if (timeStep == pun_duration) {
|
if (timeStep == pun_duration) {
|
||||||
qCritical() << "(" << __func__ << ":" << __LINE__ << ") return price" << price;
|
qCritical() << "(" << __func__ << ":" << __LINE__ << ") return price" << price;
|
||||||
|
@@ -606,6 +606,10 @@ bool Configuration::ParseJson(Configuration* cfg, const char* json)
|
|||||||
if (k->value.IsInt()) {
|
if (k->value.IsInt()) {
|
||||||
this->currentPaymentOptions.last().pop_minus_steps = k->value.GetInt();
|
this->currentPaymentOptions.last().pop_minus_steps = k->value.GetInt();
|
||||||
}
|
}
|
||||||
|
} else if (strcmp(inner_obj_name, "pop_allow_overpay") == 0) {
|
||||||
|
if (k->value.IsBool()) {
|
||||||
|
this->currentPaymentOptions.last().pop_allow_overpay = k->value.GetBool();
|
||||||
|
}
|
||||||
} else if (strcmp(inner_obj_name, "pop_payment_method_id") == 0) {
|
} else if (strcmp(inner_obj_name, "pop_payment_method_id") == 0) {
|
||||||
this->currentPaymentOptions.last().pop_payment_method_id = k->value.GetInt();
|
this->currentPaymentOptions.last().pop_payment_method_id = k->value.GetInt();
|
||||||
} else if (strcmp(inner_obj_name, "pop_day_end_time") == 0) {
|
} else if (strcmp(inner_obj_name, "pop_day_end_time") == 0) {
|
||||||
|
@@ -207,7 +207,13 @@ bool Utilities::IsYearPeriodActive(Configuration const *cfg, QDateTime const &dt
|
|||||||
dt.date().day());
|
dt.date().day());
|
||||||
QDate const s(2004, year.second.pye_start_month, year.second.pye_start_day);
|
QDate const s(2004, year.second.pye_start_month, year.second.pye_start_day);
|
||||||
QDate const e(2004, year.second.pye_end_month, year.second.pye_end_day);
|
QDate const e(2004, year.second.pye_end_month, year.second.pye_end_day);
|
||||||
|
//qCritical() << __func__ << __LINE__ << " d" << d.toString(Qt::ISODate);
|
||||||
|
//qCritical() << __func__ << __LINE__ << "start" << s.toString(Qt::ISODate);
|
||||||
|
//qCritical() << __func__ << __LINE__ << " end" << e.toString(Qt::ISODate);
|
||||||
|
if (s <= e) {
|
||||||
return (d >= s && d <= e);
|
return (d >= s && d <= e);
|
||||||
|
}
|
||||||
|
return (d >= s || d <= e);
|
||||||
})) {
|
})) {
|
||||||
qCritical() << "NO VALID YEAR PERIOD";
|
qCritical() << "NO VALID YEAR PERIOD";
|
||||||
return false;
|
return false;
|
||||||
|
@@ -47,11 +47,11 @@ extern "C" char* strptime(const char* s,
|
|||||||
#define NEUHAUSER_CHRISTOPH_REISEN (0)
|
#define NEUHAUSER_CHRISTOPH_REISEN (0)
|
||||||
#define NEUHAUSER_PERNEGG_AN_DER_MUR (0)
|
#define NEUHAUSER_PERNEGG_AN_DER_MUR (0)
|
||||||
#define NEUHAUSER_STOCKERAU (0)
|
#define NEUHAUSER_STOCKERAU (0)
|
||||||
#define KLEIPEDA_LITAUEN (1)
|
#define KLEIPEDA_LITAUEN (0)
|
||||||
#define SEXTEN (0)
|
#define SEXTEN (0)
|
||||||
#define SCHNALS_LEITER_KIRCHL (0)
|
#define SCHNALS_LEITER_KIRCHL (0)
|
||||||
#define SCHNALS_STAUMAUER (SCHNALS_LEITER_KIRCHL)
|
#define SCHNALS_STAUMAUER (SCHNALS_LEITER_KIRCHL)
|
||||||
#define VALSER_ALM (0)
|
#define VALSER_ALM (1)
|
||||||
|
|
||||||
#if NEUHAUSER_KIRCHDORF==1
|
#if NEUHAUSER_KIRCHDORF==1
|
||||||
static bool test_neuhauser_kirchdorf(int step, double cost) {
|
static bool test_neuhauser_kirchdorf(int step, double cost) {
|
||||||
@@ -919,22 +919,24 @@ int main() {
|
|||||||
s.setTime(QTime(12, 0, 0));
|
s.setTime(QTime(12, 0, 0));
|
||||||
|
|
||||||
int minimal_parking_price = get_minimal_parkingprice(&cfg,
|
int minimal_parking_price = get_minimal_parkingprice(&cfg,
|
||||||
PermitType(PERMIT_TYPE::SHORT_TERM_PARKING),
|
PermitType(PERMIT_TYPE::SHORT_TERM_PARKING_PKW),
|
||||||
paymentOptionIndex, s);
|
paymentOptionIndex, s);
|
||||||
|
|
||||||
|
#if 0
|
||||||
qCritical() << "minimal parking price" << minimal_parking_price;
|
qCritical() << "minimal parking price" << minimal_parking_price;
|
||||||
|
|
||||||
for (int i = 0; i < 8; ++i) {
|
for (int i = 0; i < 8; ++i) {
|
||||||
calcState = compute_duration_for_parking_ticket(&cfg, s,
|
calcState = compute_duration_for_parking_ticket(&cfg, s,
|
||||||
(double)minimal_parking_price + i*800,
|
(double)minimal_parking_price + i*800,
|
||||||
end, PermitType(PERMIT_TYPE::SHORT_TERM_PARKING));
|
end, PermitType(PERMIT_TYPE::SHORT_TERM_PARKING_PKW));
|
||||||
qCritical() << "RUN" << i << end.toString(Qt::ISODate) << calcState.toString();
|
qCritical() << "RUN" << i << end.toString(Qt::ISODate) << calcState.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
s.setTime(QTime(15, 0, 0));
|
s.setTime(QTime(15, 0, 0));
|
||||||
|
|
||||||
minimal_parking_price = get_minimal_parkingprice(&cfg,
|
minimal_parking_price = get_minimal_parkingprice(&cfg,
|
||||||
PermitType(PERMIT_TYPE::SHORT_TERM_PARKING),
|
PermitType(PERMIT_TYPE::SHORT_TERM_PARKING_PKW),
|
||||||
paymentOptionIndex, s);
|
paymentOptionIndex, s);
|
||||||
|
|
||||||
qCritical() << "minimal parking price" << minimal_parking_price;
|
qCritical() << "minimal parking price" << minimal_parking_price;
|
||||||
@@ -942,9 +944,10 @@ int main() {
|
|||||||
for (int i = 0; i < 8; ++i) {
|
for (int i = 0; i < 8; ++i) {
|
||||||
calcState = compute_duration_for_parking_ticket(&cfg, s,
|
calcState = compute_duration_for_parking_ticket(&cfg, s,
|
||||||
(double)minimal_parking_price + i*800,
|
(double)minimal_parking_price + i*800,
|
||||||
end, PermitType(PERMIT_TYPE::SHORT_TERM_PARKING));
|
end, PermitType(PERMIT_TYPE::SHORT_TERM_PARKING_PKW));
|
||||||
qCritical() << "RUN" << i << end.toString(Qt::ISODate) << calcState.toString();
|
qCritical() << "RUN" << i << end.toString(Qt::ISODate) << calcState.toString();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user