Set seconds of serveral date-times to 0.
Compute netto_parking_time (which includes carry-over duration).
This commit is contained in:
parent
d8d32820a3
commit
577a17dc6a
@ -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);
|
qCritical() << __func__ << ":" << __LINE__ << "effectiveStartTime:" << effectiveStartTime.toString(Qt::ISODate);
|
||||||
|
|
||||||
int const carryOver = tariff->getPaymentOptions(paymentOptionIndex).pop_carry_over;
|
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();
|
//QTime const &tlimit = wd.getTariffCarryOverSettings().parkingTimeLimit();
|
||||||
//end_parking_time.setTime(tlimit);
|
//end_parking_time.setTime(tlimit);
|
||||||
|
|
||||||
|
// max_price neu berechnen
|
||||||
|
|
||||||
calcState.setDesc(QString("line=%1 endTime=%2: park-time-limit violated").arg(__LINE__)
|
calcState.setDesc(QString("line=%1 endTime=%2: park-time-limit violated").arg(__LINE__)
|
||||||
.arg(end_parking_time.time().toString(Qt::ISODate)));
|
.arg(end_parking_time.time().toString(Qt::ISODate)));
|
||||||
return calcState.set(CalcState::State::ABOVE_MAX_PARKING_TIME);
|
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) {
|
if (pop_time_step_config == (int)ATBTimeStepConfig::TimeStepConfig::STATIC) {
|
||||||
// handle prepaid option
|
// handle prepaid option
|
||||||
QDateTime effectiveStartTime(start_parking_time);
|
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;
|
int const prepaid_option_id = tariff->getPaymentOptions(paymentOptionIndex).pop_prepaid_option_id;
|
||||||
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()) {
|
||||||
@ -1102,8 +1111,9 @@ CalcState CALCULATE_LIBRARY_API compute_duration_for_parking_ticket(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
QDateTime start(start_parking_time);
|
||||||
QString cs = start_parking_time.toString(Qt::ISODate);
|
start.setTime(QTime(start.time().hour(), start.time().minute(), 0));
|
||||||
|
QString cs = start.toString(Qt::ISODate);
|
||||||
|
|
||||||
std::pair<std::string, QDateTime> p_endTime
|
std::pair<std::string, QDateTime> p_endTime
|
||||||
= Calculator::GetInstance().GetDurationFromCost(
|
= Calculator::GetInstance().GetDurationFromCost(
|
||||||
@ -1181,8 +1191,14 @@ CalcState CALCULATE_LIBRARY_API compute_duration_for_parking_ticket(
|
|||||||
} else {
|
} else {
|
||||||
ticketEndTime = QDateTime::fromString(endTime,Qt::ISODate);
|
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__ << "ticketEndTime:" << ticketEndTime.toString(Qt::ISODate);
|
||||||
qCritical() << __func__ << ":" << __LINE__ << "step-config:" << pop_time_step_config;
|
qCritical() << __func__ << ":" << __LINE__ << "step-config:" << pop_time_step_config;
|
||||||
|
qCritical() << __func__ << ":" << __LINE__ << "netto-parking-time" << netto_parking_time;
|
||||||
|
|
||||||
if (!ticketEndTime.isValid()) {
|
if (!ticketEndTime.isValid()) {
|
||||||
calcState.setDesc(QString("ticketEndTime=%1").arg(endTime));
|
calcState.setDesc(QString("ticketEndTime=%1").arg(endTime));
|
||||||
|
Loading…
Reference in New Issue
Block a user