Handle SUCCESS_MAXPRICE (calc-state).

This commit is contained in:
Gerhard Hoffmann 2024-09-16 16:53:44 +02:00
parent dbedfd094f
commit 205896903b

View File

@ -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<int> 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,