diff --git a/library/src/calculate_price.cpp b/library/src/calculate_price.cpp index 531d326..01275e1 100644 --- a/library/src/calculate_price.cpp +++ b/library/src/calculate_price.cpp @@ -885,6 +885,9 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket( } } + effectiveStartTime.setTime(QTime(effectiveStartTime.time().hour(), + effectiveStartTime.time().minute(), 0)); + qCritical() << __func__ << ":" << __LINE__ << "effectiveStartTime:" << effectiveStartTime.toString(Qt::ISODate); int const carryOver = tariff->getPaymentOptions(paymentOptionIndex).pop_carry_over; @@ -950,6 +953,8 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket( //QTime const &tlimit = wd.getTariffCarryOverSettings().parkingTimeLimit(); //end_parking_time.setTime(tlimit); + // max_price neu berechnen + calcState.setDesc(QString("line=%1 endTime=%2: park-time-limit violated").arg(__LINE__) .arg(end_parking_time.time().toString(Qt::ISODate))); return calcState.set(CalcState::State::ABOVE_MAX_PARKING_TIME); @@ -1086,6 +1091,10 @@ CalcState CALCULATE_LIBRARY_API compute_duration_for_parking_ticket( if (pop_time_step_config == (int)ATBTimeStepConfig::TimeStepConfig::STATIC) { // handle prepaid option QDateTime effectiveStartTime(start_parking_time); + + effectiveStartTime.setTime(QTime(effectiveStartTime.time().hour(), + effectiveStartTime.time().minute(), 0)); + int const prepaid_option_id = tariff->getPaymentOptions(paymentOptionIndex).pop_prepaid_option_id; std::optional prepaidOption = tariff->getPrepaidType(prepaid_option_id); if (prepaidOption.has_value()) { @@ -1102,8 +1111,9 @@ CalcState CALCULATE_LIBRARY_API compute_duration_for_parking_ticket( } } } - - QString cs = start_parking_time.toString(Qt::ISODate); + QDateTime start(start_parking_time); + start.setTime(QTime(start.time().hour(), start.time().minute(), 0)); + QString cs = start.toString(Qt::ISODate); std::pair p_endTime = Calculator::GetInstance().GetDurationFromCost( @@ -1181,8 +1191,14 @@ CalcState CALCULATE_LIBRARY_API compute_duration_for_parking_ticket( } else { ticketEndTime = QDateTime::fromString(endTime,Qt::ISODate); + ticketEndTime.setTime(QTime(ticketEndTime.time().hour(), + ticketEndTime.time().minute(), 0)); + + int netto_parking_time = start_parking_time.secsTo(ticketEndTime) / 60; + qCritical() << __func__ << ":" << __LINE__ << "ticketEndTime:" << ticketEndTime.toString(Qt::ISODate); qCritical() << __func__ << ":" << __LINE__ << "step-config:" << pop_time_step_config; + qCritical() << __func__ << ":" << __LINE__ << "netto-parking-time" << netto_parking_time; if (!ticketEndTime.isValid()) { calcState.setDesc(QString("ticketEndTime=%1").arg(endTime));