From 205896903bc76c729193d41ca911522d1af1d58e Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Mon, 16 Sep 2024 16:53:44 +0200 Subject: [PATCH] Handle SUCCESS_MAXPRICE (calc-state). --- library/src/calculate_price.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/library/src/calculate_price.cpp b/library/src/calculate_price.cpp index fbacfb9..d0ffdec 100644 --- a/library/src/calculate_price.cpp +++ b/library/src/calculate_price.cpp @@ -26,6 +26,7 @@ QString const CalcState::BELOW_MIN_PARKING_PRICE = "BELOW_MIN_PARKING_PRICE"; QString const CalcState::ABOVE_MAX_PARKING_PRICE = "ABOVE_MAX_PARKING_PRICE"; QString const CalcState::OVERPAID = "OVERPAID"; QString const CalcState::OUTSIDE_ALLOWED_PARKING_TIME = "OUTSIDE_ALLOWED_PARKING_TIME"; +QString const CalcState::SUCCESS_MAXPRICE = "SUCCESS_MAXPRICE"; QList CALCULATE_LIBRARY_API get_time_steps(Configuration *cfg) { return Calculator::GetInstance().GetTimeSteps(cfg); @@ -818,6 +819,13 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket( qCritical() << __func__ << ":" << __LINE__ << " re-computed prepaid-id" << pop_prepaid_option_id; } + QTime carryOverStart = tariff->TariffCarryOverOptions.find(pop_carry_over_option_id)->second.carryover[weekDay].static_start; + int carryOverDuration = tariff->TariffCarryOverOptions.find(pop_carry_over_option_id)->second.carryover[weekDay].duration; + + qCritical() << __func__ << ":" << __LINE__ << " carryOverStart" << carryOverStart.toString(Qt::ISODate); + qCritical() << __func__ << ":" << __LINE__ << "carryOverDuration" << carryOverDuration; + + QDateTime effectiveStartTime(start_parking_time); // handle special days @@ -1103,6 +1111,12 @@ CalcState CALCULATE_LIBRARY_API compute_duration_for_parking_ticket( if (endTime == CalcState::SUCCESS) { calcState.setDesc(QString("SUCCESS")); calcState.setStatus(endTime); + qCritical() << __func__ << ":" << __LINE__ << "SUCCESS"; + } else + if (endTime == CalcState::SUCCESS_MAXPRICE) { + calcState.setDesc(QString("SUCCESS_MAXPRICE")); + calcState.setStatus(endTime); + qCritical() << __func__ << ":" << __LINE__ << "SUCCESS_MAXPRICE"; } else if (endTime == CalcState::ERROR_PARSING_ZONE_NR) { calcState.setStatus(endTime); @@ -1255,7 +1269,9 @@ CalcState CALCULATE_LIBRARY_API compute_duration_for_parking_ticket( return calcState.set(CalcState::State::INVALID_START_DATE); } - return calcState.set(CalcState::State::SUCCESS); + //return calcState.set(CalcState::State::SUCCESS); + qCritical() << __func__ << ":" << __LINE__ << " calcState" << calcState.toString(); + return calcState; } CalcState CALCULATE_LIBRARY_API compute_duration_for_daily_ticket(parking_tariff_t *tariff,